6

I recently updated my MacOS to Catalina, and now I have the infamous "zsh command not found: conda" when I enter "conda" in my terminal. I've read a number of solutions, and the easiest for me to try was to reinstall Anaconda in my home directory (specifically, the 2019.10 version of the installer installs in Users/myname/opt/anaconda3), as suggested by the folks at Anaconda here.

Well, I did just that and it did not solve the problem. What am I missing?

hongsy
  • 1,498
  • 1
  • 27
  • 39
  • 3
    Conda installs scripts for bash, but not zsh. The easiest way is to fire up bash, and run `conda init zsh` (from bash) this will put the appropriate code in you zsh profile (you'll need to start a new terminal session). – Mark Jan 21 '20 at 02:34
  • 1
    Thank you for your help. I switched my user account to bash and found that conda ran immediately without additional work. I guess that's because conda runs on bash. But I did the zsh switch as you suggested, and the conda command works now on zsh. – Ashton T. Sperry Jan 22 '20 at 19:55
  • Glad it worked. – Mark Jan 22 '20 at 20:15

3 Answers3

19

From the Anaconda install docs:

In order to initialize after the installation process is done, first run source <path to conda>/bin/activate and then run conda init.

However,

If you are on macOS Catalina, the new default shell is zsh. You will instead need to run source <path to conda>/bin/activate followed by conda init zsh.

hongsy
  • 1,498
  • 1
  • 27
  • 39
0

I tried in Macbook M1 Air with the following command.

(your conda installation path)/bin/conda init zsh

Example:

/Users/<username>/opt/anaconda3//bin/conda init zsh

Then restarted the terminal and executed the command

conda activate base

It worked perfectly

Source command is taken is from here

Santhosh s
  • 184
  • 1
  • 5
0

After installing miniconda on macos, we need to initialize the zsh. Different from the command ~/miniconda3/bin/conda init for the legacy bash, we need to add zsh in the end, i.e., ~/miniconda3/bin/conda init zsh. Then restart the terminal.