Introduction
I have experienced the AI coding for three stages.
Stage 1: vs code plugin, started from openai codex, then other LLM plugin like ClaudeDev, Cline
Stage 2: customer GUI like Cursor, Windsurf
Stage 3: command line based, CLI, Anthropic Claude Code, Openai codex, Gemini code.
CLI Installation
OpenAI Codex CLI Installation: The official method is via npm. On Linux/macOS, you can install globally with:
npm install -g @openai/codex
This places the codex command in your PATHcodeant.ai. If you don’t have root, using nvm to manage Node lets you do -g installs in user space. On macOS or Linux, you can also use Homebrew as an alternative: for example, brew install codex is supported for a one-command installationzitniklab.hms.harvard.edu. If you cannot or prefer not to install globally, you can run Codex CLI with npx (which fetches and executes the package without persistent install). For example:
npx @openai/codex [command]
This will download the CLI package on-the-fly and run it. After installation, set your OpenAI API key in the environment:
Anthropic Claude Code CLI Installation: Claude’s CLI is also distributed via npm. Install it globally with:
npm install -g @anthropic-ai/claude-code
(The package name might also be @anthropic/claude-cli in earlier versionseducative.io, but the latest is as above.) Like with Codex, using nvm or a user-local Node setup will let you do this without root. Once installed, run claude in any project folder to start a sessioncodeant.aicodeant.ai. The first time, it will prompt you to log in or provide an API key. You should have your Anthropic API Key ready (after signing up for Claude API or Claude Pro). Set the key as an environment variable for convenience:
export CLAUDE_API_KEY="your-api-key-here"
(Or you might be asked to paste it at prompt.) After launching, you’ll see a welcome screen possibly asking to choose a theme, then you’ll be in a chat-like interface in the terminal. Claude CLI doesn’t require root for any of this. On macOS, Homebrew might not have an official formula, but you could use brew install anthropic-cli if a community cask exists. Otherwise, npm or npx is the way. Using npx:
npx @anthropic-ai/claude-code
Google Gemini CLI Installation: You have multiple options and it’s quite flexible:
-
Quick run without install: Use npx to run directly from GitHub:
npx https://github.com/google-gemini/gemini-cliThis fetches and executes the CLI from the repository (ensuring you get the latest version)codeant.ai. This method is great if you don’t want to install anything system-wide – no root needed, just requires Node and internet access.
-
Global install via npm:
npm install -g @google/gemini-cliThen launch with
geminicodeant.ai. Again, with nvm or user Node, no root is needed. After runninggeminithe first time, it will prompt you to log in. You can choose to authenticate with your Google account (a browser-based OAuth flow) or use a Gemini API keycodeant.ai. For most users, logging in with Google is simplest – it ties into the free tier usage. If you have a Google Cloud project and obtained an API key (from Google AI Studio) for Gemini, you can export it:
Gemini installation Debug
Intel PC with GTX 1080 WSL2.
用 web authorize, check ~/.gemini/settings.json { “security”: { “auth”: { “selectedType”: “oauth-personal” } } }
AMD PC with RTX 3060 WSL2.
用 web authorize, check ~/.gemini/settings.json { “security”: { “auth”: { “selectedType”: “gemini-api-key” } } }
另外在 .basrhc 要設定 GEMINI_API_KEY 可以在這個 website get API KEY https://aistudio.google.com/app/api-keys