Codex install with Miniconda (no sudo)
This setup installs Node.js and the Codex CLI inside a Miniconda environment in your home directory. It does not require administrator access or sudo.
1. Install Miniconda (skip if already installed)
For a Linux x86-64 computer:
cd /tmp
curl -O https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash Miniconda3-latest-Linux-x86_64.sh -b -p "$HOME/miniconda3"
source "$HOME/miniconda3/etc/profile.d/conda.sh"
conda init bashClose and reopen the terminal after conda init bash.
If Miniconda is already installed but conda is not available in the current terminal, run:
source "$HOME/miniconda3/etc/profile.d/conda.sh"2. Create an environment for Codex
conda create --name codex_env --channel conda-forge nodejs=22 --yes
conda activate codex_envUsing a separate environment prevents Codex and Node.js packages from changing other Conda projects.
3. Install the Codex CLI
npm install --global @openai/codexAlthough this is an npm “global” install, the active Conda environment places it under $HOME/miniconda3/envs/codex_env; it does not write to system folders and therefore does not need sudo.
Verify the installation:
which codex
codex --versionThe which output should look similar to:
/home/YOUR_USERNAME/miniconda3/envs/codex_env/bin/codex
4. Sign in and start Codex
codex login
codex login status
codexFollow the browser sign-in instructions shown by codex login. For the official installation and authentication guidance, see the OpenAI Codex CLI documentation.
Use Codex later
In each new terminal session, activate the environment before starting Codex:
conda activate codex_env
cd /path/to/your/project
codexFor the login-status check, browser sign-in steps, and the September 14, 2026 login example, see CODEX_LOGIN_README.md. A saved login normally survives a terminal restart, so codex login is only needed when codex login status says you are signed out.
When finished:
conda deactivateUpdate Codex
conda activate codex_env
npm install --global @openai/codex@latest
codex --versionTroubleshooting
If conda activate reports that the shell is not initialized:
source "$HOME/miniconda3/etc/profile.d/conda.sh"
conda activate codex_envIf npm install --global reports a permissions error, confirm that the Conda environment is active and that Node and npm come from it:
conda activate codex_env
which node
which npmBoth paths should contain miniconda3/envs/codex_env. Do not use sudo npm.