Skip to content

Install Node.js on macOS

Node.js is required for running tools like CodeX CLI, Gemini CLI, and CC-Switch.

Method 1: Official Installer

  1. Visit https://nodejs.org
  2. Download the LTS version for macOS (.pkg file)
  3. Run the installer and follow the prompts
  4. Verify installation:
bash
node -v
npm -v

If you have Homebrew installed:

bash
brew install node

Verify:

bash
node -v
npm -v

Method 3: Using fnm (Fast Node Manager)

fnm is the recommended way to manage multiple Node.js versions.

Install fnm

bash
brew install fnm

Or via the install script:

bash
curl -fsSL https://fnm.vercel.app/install | bash

Install Node.js

bash
fnm install --lts
fnm use lts-latest
fnm default lts-latest

Add 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 ~/.zshrc

Method 4: Using nvm

bash
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.0/install.sh | bash

Restart your terminal, then:

bash
nvm install --lts
nvm use --lts

Troubleshooting

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 PreferencesSecurity & Privacy → click Open Anyway.

3xCoder — Unified AI API Endpoint