Fix zsh: command not found: conda on macOS

Quick answer: zsh: command not found: conda means the current zsh process cannot resolve a conda executable on PATH. Locate the actual installation, run the installed executable with conda init zsh, open a fresh shell, and test command lookup before trying conda activate.

Python Pool infographic showing zsh, PATH, Conda installation, conda init, shell reload, and environment activation
Separate installation, PATH lookup, shell initialization, and activation so the same command-not-found message leads to the right fix.

The zsh: command not found: conda message means zsh searched the current command path and did not find a runnable conda program. It is usually a shell setup problem, not a Python import problem. Conda may be installed correctly, but the current zsh session does not know where its executable or shell hook lives.

This often happens after installing Anaconda or Miniconda on macOS, switching the default shell from bash to zsh, copying an old .bashrc setup, or opening a terminal window before Conda initialization was finished. The reliable fix is to confirm where Conda is installed, initialize it for zsh, restart the shell, and then test conda activate again.

The official Conda documentation covers conda init, installing Conda on macOS, and managing Conda environments.

Start by separating three cases. First, Conda is installed and zsh cannot find it. Second, Conda was installed in a different account or folder. Third, Conda is not installed at all. The same terminal message can appear in all three cases, so guessing often wastes time.

Check What zsh Can See

Python can safely inspect the current process path without requiring Conda. If this code prints that Conda was not found, it mirrors what zsh is likely seeing in that terminal session.

import os
import shutil

shell_name = os.path.basename(os.environ.get("SHELL", ""))
conda_path = shutil.which("conda")

print("shell:", shell_name or "unknown")
print("conda found:", bool(conda_path))

if conda_path:
    print("conda path:", conda_path)
else:
    print("zsh would report: command not found: conda")

If the shell is not zsh, fix the shell you are actually using. If the shell is zsh and Conda is missing from lookup, continue with the zsh startup files and installation folder checks below.

Inspect zsh Startup Files

For interactive terminal work, zsh commonly reads ~/.zshrc. Login shells may also read ~/.zprofile. Conda’s zsh setup usually adds a managed block to one of these files after conda init zsh runs.

from pathlib import Path

home = Path.home()
startup_files = [home / ".zshrc", home / ".zprofile", home / ".bashrc"]

for path in startup_files:
    status = "present" if path.exists() else "missing"
    print(f"{path.name}: {status}")

Do not paste random PATH lines into every startup file. Duplicate entries can make later debugging harder. Prefer the official conda init zsh command once you know the Conda executable is available.

Python Pool infographic showing macOS terminal, zsh PATH, conda command, shell lookup, and command-not-found error
The shell cannot find the conda executable or its shell integration in the current environment.

Find A Likely Conda Install

Common locations include a Miniconda or Anaconda folder in the home directory, or an installation under /opt. The exact path depends on the installer and choices made during setup.

from pathlib import Path

home = Path.home()
possible_roots = [
    home / "miniconda3",
    home / "anaconda3",
    Path("/opt/miniconda3"),
    Path("/opt/anaconda3"),
]

for root in possible_roots:
    conda_bin = root / "bin" / "conda"
    result = "possible" if conda_bin.exists() else "not found"
    print(f"{root}: {result}")

If none of the usual locations exists, Conda may not be installed for this user account. Reinstalling Miniconda from the official installer can be cleaner than editing shell files around a missing program.

Initialize Conda For zsh

When you can run the Conda executable by full path, initialize zsh with conda init zsh. That command updates shell startup configuration so future zsh sessions load Conda’s activation hook.

from pathlib import Path

candidate = Path.home() / "miniconda3" / "bin" / "conda"

if candidate.exists():
    print(f"{candidate} init zsh")
else:
    print("conda init zsh")
    print("Run this only after the conda command is available")

After initialization, close the terminal window and open a new one. You can also reload zsh configuration with source ~/.zshrc, but a new terminal window is the simplest test because it uses the same startup path as normal daily work.

Check PATH Order

PATH order matters because the shell checks entries from left to right. If an old Conda folder, broken symlink, or unrelated tool directory appears first, the terminal may find the wrong command or no command at all.

import os

path_parts = [part for part in os.environ.get("PATH", "").split(os.pathsep) if part]

for index, part in enumerate(path_parts[:8], start=1):
    print(f"{index}: {part}")

if not path_parts:
    print("PATH is empty in this process")

A healthy setup does not need many manual PATH edits. Let Conda’s generated shell block do the activation work, and remove old hand-written Anaconda entries only after backing up the startup file.

Python Pool infographic mapping conda executable through conda init zsh to shell hook and available command
Conda's shell initialization adds the integration needed for a new zsh session to recognize conda commands.

Retest With The Same Terminal Flow

Once zsh has been initialized, run the same checks in a new terminal: command -v conda, conda --version, and conda activate base. These checks confirm command lookup, the Conda executable, and shell activation separately.

checks = [
    ("new terminal window", "open zsh again after changing startup files"),
    ("command lookup", "run command -v conda in the terminal"),
    ("Conda version", "run conda --version"),
    ("activation", "try conda activate base"),
]

for name, action in checks:
    print(f"{name}: {action}")

If conda --version works but conda activate base fails, the executable is visible but the shell hook is not loaded correctly. Run conda init zsh again from the working Conda executable, then restart the terminal.

If command -v conda still prints nothing, look for a mismatched install location, a startup file that is not being read, or an installation owned by another user. If both conda and python point to unexpected locations, review the active terminal setup before changing project code.

On shared laptops or lab machines, avoid changing global shell files until you know which account owns the Conda install. A local user setup is easier to repair than a broad profile change that affects every terminal session on the machine.

In short, fix zsh: command not found: conda by proving whether Conda exists, initializing Conda for zsh with the official command, opening a new shell, and testing command lookup before trying package installs or Python scripts.

Separate Installation From PATH

The message does not prove Conda is absent. It can mean Conda is installed in another directory, belongs to another user, or was initialized for a different shell. Start with command -v conda and inspect likely installation roots.

Python Pool infographic showing shell configuration file, source or new terminal, conda command, and environment prompt
Open a new terminal or reload the configured shell so the updated function and PATH are available.

Understand zsh Startup Files

Interactive and login shells can load different startup files. Avoid copying random PATH lines into every file; use the official initialization command after locating the executable, then inspect the managed block it creates.

Initialize The Shell Once

Run the full path to conda init zsh when the bare command is unavailable. Close and reopen the terminal, or source the correct configuration for a controlled test. A new shell is the clearest check of daily behavior.

Test The Activation Boundary

First confirm command -v conda, then conda –version, then conda env list, and only after that conda activate. Each command tests a different boundary and makes the next failure easier to interpret.

Python Pool infographic testing installation path, architecture, shell config, PATH duplicates, and validation
Check the actual installation, shell config, architecture, PATH entries, and whether another Python manager is conflicting.

Avoid Duplicate Environment Setup

Multiple Conda installations or repeated PATH edits can make one terminal appear fixed while another uses a different executable. Remove stale assumptions only after recording which installation and shell the project should use.

Make Team Setup Reproducible

Document the supported installer, shell initialization command, environment file, and verification steps. Do not commit personal absolute paths when a project environment file can describe the dependencies instead.

Use the official Conda init documentation, macOS installation guide, and environment guide. Related guidance includes package setup and interpreter checks.

For related environment setup, compare package configuration, interpreter checks, and virtual environment cleanup when making a shell fix reproducible.

For the authoritative API and current behavior, consult the conda init documentation.

Frequently Asked Questions

Why does zsh say command not found conda?

The current zsh process cannot find a conda executable on PATH, even if Conda is installed elsewhere or its shell hook was not initialized.

How do I initialize Conda for zsh?

Run the installed Conda executable with conda init zsh, then open a new terminal or reload the appropriate zsh startup configuration.

Where is Conda commonly installed on macOS?

Common locations include ~/miniconda3, ~/anaconda3, and installer-specific paths; verify the actual conda executable instead of assuming a folder.

Why does conda work in one terminal but not another?

The sessions may load different startup files, users, shells, PATH values, or Conda installations; compare command -v conda and the shell configuration in both.

Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted