Skip to content

Codex Installation Tutorial for China: CLI Usage Guide

Official Channel

Codex Installation Tutorial for China: CLI Usage Guide

Solve overseas payment issues and unlock full GPT-4 features

  • ✔ Official channel
  • ✔ Alipay/WeChat Pay
  • ✔ Auto activation in 5 min
  • ✔ 24h service
⭐ 4.9 rating (1200+ reviews)· 24h Service
Official price $24/mo
$22/mo
Save $2
Upgrade to GPT-5 Now →

The GPT-5-Codex update OpenAI released a while ago made this powerful AI coding tool go viral almost overnight. More and more developers, programmers and AI enthusiasts are exploring Codex's potential — and especially in China, how to install and use Codex CLI stably has become a hot topic. As a long-time AI tool user, I keep getting questions like: how do I install Codex in China? How do I make Codex CLI reply in Chinese? Today I'm sharing a comprehensive Codex installation tutorial for China and a Codex usage guide, covering everything from beginner to advanced tips so you can get up to speed fast. Whether you're a Mac user, a Linux fan or a Windows developer, this article has practical advice for you.

This article is about 2,000 words, based on the latest version as of September 2025 and written from real testing experience. By the end, you'll understand the Codex CLI installation steps, Chinese reply configuration and common troubleshooting. If you're new to AI coding, don't worry — we'll take it step by step.

1. What Is Codex and Why Should Developers in China Choose It?

In the AI coding era, Codex — OpenAI's flagship product — is leading a revolution. It's not just a code generator; it's an intelligent coding agent that handles complex tasks such as automated debugging, code refactoring and multi-file collaboration. Codex's core strength comes from its GPT-5-based model: the latest GPT-5-Codex version can run independently on large, complex tasks for over 7 hours, far surpassing traditional tools.

Codex comes in two main forms:

  • Codex Web (cloud version): Access it directly through the ChatGPT web page — great for quick testing.
  • Codex CLI (local version): A terminal command-line tool that supports macOS and Linux (Windows via WSL), letting you read, modify and run code locally.

Codex stands out compared to other AI coding tools. If you know Cursor, you know it's an excellent AI IDE editor; but if you prefer the command line, Codex CLI is similar to Claude Code or Gemini CLI — yet more stable. Why not choose Claude Code? Claude has been getting "smarter-shamed" recently (downgraded intelligence) and is prone to account bans, so many users rely on mirror sites to access it. Codex, by contrast, is built on a ChatGPT Plus subscription, carries a low ban risk, and the subscription is affordable (about $20 a month), which users in China can easily obtain through a proxy.

In China, Codex's popularity comes from its Chinese-language support and low barrier to entry. Whether you're building web apps, data analysis scripts or game logic, Codex accelerates your development workflow. Next, let's dive into the Codex installation tutorial.

(No images)

2. Codex Installation Guide for China: CLI and Web Versions Explained

Installing Codex is simple and efficient — you can use it directly on the ChatGPT web page or deploy the CLI version locally. Users in China need to pay attention to the network environment: we recommend a stable proxy (such as the TZ magic tool) to avoid access restrictions. Here are the steps to install Codex CLI in China, with macOS and Linux as the priority.

2.1 Installing Codex CLI in the Terminal: For Mac and Linux Users

Codex CLI is the core of the coding agent — it wakes up the AI assistant right in your local terminal. It currently supports macOS and Linux; Windows has experimental support, and WSL is recommended. Installing directly on Windows may lead to garbled text or compatibility issues — a waste of time.

Codex CLI offers two installation methods: npm (requires a Node.js environment) and Homebrew. Pick one. I personally use npm because I already have Node.js installed.

(1) Via npm: Install the Node.js Environment First

Ubuntu/Debian Linux users: Run the following command to install Node.js 22.x in one shot (recommended for 2025):

curl -fsSL https://deb.nodesource.com/setup_22.x | sudo bash -
sudo apt-get install -y nodejs
node --version
npm --version

After verifying the versions, install Codex CLI:

npm install -g @openai/codex

macOS users: First install Xcode and Homebrew (if you haven't already):

sudo xcode-select --install
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install node
node --version

Then install the CLI:

npm install -g @openai/codex

(2) Via Homebrew (macOS only):

brew install codex

Once installed, create a project directory, cd into it in the terminal, and run codex to wake it up. On first use you'll need to log in with your ChatGPT Plus account (see Section 3.3).

Installation tip: When downloading npm packages in China, if the network is slow, switch to the Taobao mirror: npm config set registry https://registry.npmmirror.com. The whole process takes 5–10 minutes.

2.2 Codex Web (Cloud Version): Get Started Quickly with Zero Installation

Don't want a local install? Just log in to chat.openai.com and select the GPT-5-Codex model. Type a prompt like "write a web crawler in Python" and it generates the code. It's great for beginners testing out Codex's Chinese replies.

3. Codex CLI Usage Guide: From Basics to Advanced Tips

After installing, how do you use Codex CLI efficiently? Here's a Codex CLI usage tutorial, including setting up Chinese replies, model switching and authorized login. Based on my real experience, these tips will help you avoid 80% of common pitfalls.

3.1 How to Make Codex CLI Reply in Chinese: A Permanent Configuration Guide

By default Codex replies in English, but users in China usually prefer Chinese. A one-off command like "reply in simplified Chinese" works, but it resets after a restart. The recommended approach is to use the Codex memory file AGENTS.md to configure it permanently.

Global setup steps:

  1. In the terminal, run:
    mkdir -p ~/.codex && printf 'Always respond in Chinese-simplified\n' > ~/.codex/AGENTS.md
  2. Restart the terminal, run codex, and type a query like "explain this Python function" — Codex will always respond in simplified Chinese.

Workspace setup: If you only want it for the current project, run /init to generate an AGENTS.md, then edit it to add "Always respond in Chinese-simplified".

This configuration improves Codex's Chinese support, making AI coding feel much friendlier. Test it: ask "how do I optimize an SQL query?" and the reply will be entirely in Chinese.

3.2 Switching and Viewing Models: Prioritize GPT-5-Codex

Codex supports multiple models; for complex tasks we recommend GPT-5-Codex (high). To view/switch models:

/model

This shows the current model list — select one with a command like /model gpt-5-codex-high. This helps you tune performance. Users in China should be careful about peak compute loads (evening peak) and switch to a lower-tier model to avoid bans.

3.3 Local Authorized Login: Enable Global Proxy to Avoid Bans

The first time you run codex you need to log in to your OpenAI account. In China, we recommend enabling the magic TZ global Tun mode to simulate an overseas IP and lower the risk of detection. As OpenAI's load increases, abuse leads to bans; this mode protects you like an "invisibility cloak".

Login steps:

  1. Run codex login and the browser jumps to the OpenAI authorization page.
  2. Enter your ChatGPT Plus credentials to complete OAuth.
  3. Test it: codex "hello world in JS".

Recommended proxy tools: Clash or V2Ray, set to global mode. The image below shows the Tun mode interface:

4. Who Is Codex CLI For and Subscription Requirements

Codex CLI is available only to ChatGPT Plus subscribers (or higher). The free tier has no access. How do you upgrade to GPT Plus? In China, one-click subscription is super convenient:

GPT one-click upgrade: https://gptplus.org.cn/

Click the link and you're done with payment and activation in about 2 minutes. The official tutorial is thorough, so beginners have nothing to worry about. Once subscribed, you get unlimited Codex queries for as little as $20 a month — unbeatable value.

The image below shows the upgrade interface:

Who is Codex for? Programmers, data scientists and beginners. Compared with paid IDEs, Codex CLI is free and open source, and it becomes even more powerful when combined with VS Code extensions (such as the OpenAI extension).

5. For Windows Users: Installing Codex CLI via WSL

Windows has only experimental native support and tends to produce garbled text. We recommend WSL (Windows Subsystem for Linux) to simulate a Linux environment and run Codex CLI stably.

5.1 WSL Installation Prerequisites and Steps

System requirements:

  • Windows 10 21H2+ or Windows 11, Pro/Enterprise edition (Home edition doesn't support Hyper-V).
  • CPU virtualization enabled (check in BIOS).

Enable the features:

  1. Control Panel > Programs and Features > Turn Windows features on or off.
  2. Tick "Virtual Machine Platform" and "Windows Subsystem for Linux".

Download the WSL installer (the 2025 version 2.5.9.0 is recommended):

  • 64-Bit: https://vip.123pan.cn/1831946356/links/wsl.2.5.9.0.x64.msi
  • ARM64: https://vip.123pan.cn/1831946356/links/wsl.2.5.9.0.arm64.msi
  • ARM64 Microsoft Store: https://vip.123pan.cn/1831946356/links/Microsoft.WSL_2.5.9.0_x64_ARM64.msixbundle

Or grab the latest from GitHub: https://github.com/microsoft/WSL/releases

Install Ubuntu: Run:

wsl --install -d Ubuntu-24.04

Network problems? Enable a proxy or edit hosts (e.g. GitHub IP: 140.82.112.3). To view available distros: wsl -l -o.

First login: Type wsl in the terminal and set a username/password. Avoid using root: open Ubuntu once from the Start menu, close it without setting a password, and use a normal user account next time.

5.2 Deploying Codex CLI in WSL

Enter WSL: wsl (or via PowerShell).

Installation is the same as on Linux (Section 2.1): install Node.js + npm install Codex CLI. Then run codex and use it seamlessly.

Performance optimization: WSL 2 with 4GB RAM allocated is more than enough — Codex CLI is lightweight. Common issue: if commands feel sluggish, check your proxy; update WSL with wsl --update.

Contact<br>me