Codex Installation Tutorial for China: CLI Usage Guide and Chinese Reply Setup (2025 Update)

9/25/2025 Codex CLIinstallation tutorialChinese setupGPT-5-CodexWSLAI codingproxy tools
Codex CLI: Check These 3 Things First

If you want to get started with Codex CLI quickly, this article first helps you assess the installation requirements, Chinese setup, and proxy environment before diving into the detailed tutorial.

Who it's for

For developers, programmers, and AI tool enthusiasts who plan to install and use Codex CLI in China.

How to do it
  1. First confirm your system environment and installation method
  2. Then complete the Chinese reply and login configuration
  3. Finally, verify usability using the troubleshooting steps in this article
Cautions

Codex versions and available features change quickly; always follow your current client and the official documentation.

OpenAI's recent GPT-5-Codex update made this powerful AI coding tool go viral quickly. More and more developers, programmers, and AI enthusiasts are starting to explore Codex's potential — and how to install and use Codex CLI stably in the domestic (China) environment has become a hot topic. As a veteran AI tool user, I've received a lot of questions: How do I install Codex in China? How do I set up Chinese replies in Codex CLI? Today, I'll share a comprehensive Codex installation tutorial for China and Codex usage guide, covering everything from beginner to advanced tips to help you get up to speed quickly. Whether you're a Mac user, a Linux fan, or a Windows developer, this article offers practical advice.

This article is about 2,000 words, based on the latest version as of September 2025 and written from actual hands-on testing. After reading it, you'll master 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? Why Should Developers in China Choose It?

In the age of AI coding, Codex, as OpenAI's flagship product, is leading a revolution. It's not just a code generator — it's an intelligent coding agent that can handle complex tasks such as automated debugging, code refactoring, and multi-file collaboration. Codex's core advantage lies in the powerful capabilities of its GPT-5-based model: the latest GPT-5-Codex version can run independently on large, complex tasks for more than 7 hours, far exceeding traditional tools.

Codex comes in two main forms:

  • Cloud version — Codex Web: accessed directly through the ChatGPT web interface, ideal for quick tests.
  • Local version — Codex CLI: a terminal command-line tool that supports macOS and Linux (Windows via WSL), allowing you to read, modify, and run code locally.

Compared with other AI coding tools, Codex stands out. Those familiar with Cursor 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 frequently been "dumbed down" recently and is prone to bans, so many users rely on mirror sites to access it. Codex, by contrast, is based on a ChatGPT Plus subscription, carries a low risk of bans, and has an affordable subscription fee (around $20/month) that users in China can easily obtain through a proxy.

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

(Image: none)

# 2. Codex Installation Guide for China: CLI and Web Versions in Detail

Installing Codex is simple and efficient — you can either use it directly on the ChatGPT web page or deploy the CLI locally. Users in China should pay attention to the network environment: a stable proxy (such as a TZ tool) is recommended to avoid access restrictions. Below are the Codex CLI installation steps for China, prioritized for macOS and Linux.

# 2.1 Codex CLI Terminal Installation: For Mac and Linux Users

Codex CLI is the core of the coding agent, letting you summon an AI assistant from your local terminal. It currently supports macOS and Linux; Windows support is experimental, and WSL is recommended. Installing directly on Windows may run into garbled text or compatibility issues — a waste of time.

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

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

Ubuntu/Debian Linux users: Run the following commands to install Node.js 22.x in one go (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 not already installed):

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) Homebrew Method (macOS only):

brew install codex

After installation, create a project directory, cd into it in the terminal, and run codex to wake it up. The first use requires logging in to your ChatGPT Plus account (see section 3.3).

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

# 2.2 Cloud Version — Codex Web: Zero-Installation Quick Start

Don't want to install locally? Just log in to chat.openai.com (opens new window) and select the GPT-5-Codex model. Enter a prompt like "write a web crawler in Python" and it will generate the code. This is great for beginners to test Codex Chinese replies.

# 3. Using Codex CLI in Detail: From Basic to Advanced Tips

After installation, how do you use Codex CLI efficiently? Below I'll share a Codex CLI usage tutorial, including setting up Chinese replies, model switching, and authorized login. Based on my actual experience, these tips can avoid 80% of common pitfalls.

# 3.1 How to Set Up Chinese Replies in Codex CLI: A Guide to Permanent Configuration

By default, Codex replies in English, but users in China prefer Chinese. Temporary commands like "reply in Simplified Chinese" work, but they reset after a restart. We recommend using the Codex memory file AGENTS.md to set 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 enter 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 AGENTS.md, then edit it to add "Always respond in Chinese-simplified".

This configuration enhances Codex Chinese support and makes AI coding more approachable. Test: ask "how do I optimize SQL queries?" and the reply will be entirely in Chinese.

# 3.2 Model Switching and Viewing: Prefer GPT-5-Codex

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

/model

This prints the current model list. Select one, e.g. /model gpt-5-codex-high. This feature helps optimize performance. Users in China should note that during peak compute-load hours (evening peak), switching to a lower-tier model can help 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 the domestic environment, we recommend enabling TZ global Tun mode to simulate an overseas IP and reduce detection risk. As OpenAI's load grows, abuse easily leads to bans; this mode protects you like an "invisibility cloak".

Login steps:

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

Proxy tool recommendations: Clash or V2Ray, set to global mode. The image below shows the Tun mode interface:

# 4. Who Should Use Codex CLI, and Subscription Requirements

Codex CLI is limited to ChatGPT Plus subscribers (or higher). Free accounts have no access. How to upgrade to GPT Plus? One-click subscription in China is super convenient:

One-click GPT upgrade: https://gptplus.org.cn/ (opens new window)

Click the link and complete payment and activation in 2 minutes. The official site has detailed tutorials, so beginners are stress-free. After subscribing, you get unlimited Codex queries for as little as $20/month — incredible value.

The image below shows the upgrade screen:

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

# 5. Windows Users Only: Installing Codex CLI via WSL

Windows native support is experimental and prone to garbled text. We recommend WSL (Windows Subsystem for Linux) to emulate 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).
  • Virtualization enabled on the CPU (check in BIOS).

Enable the features:

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

Download the WSL installer (recommended 2025 version 2.5.9.0):

  • 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 get the latest from GitHub: https://github.com/microsoft/WSL/releases

Install Ubuntu: Run:

wsl --install -d Ubuntu-24.04

Network issues? Enable a proxy or edit the hosts file (for GitHub IPs, e.g., 140.82.112.3). To see available distributions: wsl -l -o.

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

# 5.2 Deploying Codex CLI in WSL

Enter WSL: wsl (or PowerShell).

The installation steps are the same as Linux (section 2.1): install Node.js + npm install Codex CLI. Run codex and use it seamlessly.

Performance optimization: allocating 4GB RAM to WSL 2 is enough; Codex CLI is lightweight and stress-free. Common issues: if commands feel laggy, check your proxy; update WSL with wsl --update.