Appearance
Install Node.js on macOS
Node.js is required for running tools like CodeX CLI, Gemini CLI, and CC-Switch.
Method 1: Official Installer
- Visit https://nodejs.org
- Download the LTS version for macOS (
.pkgfile) - Run the installer and follow the prompts
- Verify installation:
bash
node -v
npm -vMethod 2: Using Homebrew (Recommended)
If you have Homebrew installed:
bash
brew install nodeVerify:
bash
node -v
npm -vMethod 3: Using fnm (Fast Node Manager)
fnm is the recommended way to manage multiple Node.js versions.
Install fnm
bash
brew install fnmOr via the install script:
bash
curl -fsSL https://fnm.vercel.app/install | bashInstall Node.js
bash
fnm install --lts
fnm use lts-latest
fnm default lts-latestAdd to Shell Profile
Add the following to your shell profile (~/.zshrc or ~/.bashrc):
bash
eval "$(fnm env --use-on-cd --shell zsh)"Then reload:
bash
source ~/.zshrcMethod 4: Using nvm
bash
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.0/install.sh | bashRestart your terminal, then:
bash
nvm install --lts
nvm use --ltsTroubleshooting
node: command not found
- Open a new terminal window after installation
- Check your PATH:
echo $PATH - For fnm: ensure the eval line is in your shell profile
macOS Gatekeeper Warning
If macOS blocks the installer, go to System Preferences → Security & Privacy → click Open Anyway.
