Fabian
Fabian

Reputation: 9

How can I avoid typing the "source ~/.bash_profile" command in the terminal every time?

I just installed Anaconda. When I try to run a command, lets say conda --version, I get the following error message:

zsh: command not found: conda

When I type in:

source ~/.bash_profile

Everything works:

conda --version

conda 4.8.0

But I have to type the command every time I start the terminal.

My .bash_profile looks like this:

# added by Anaconda3 2019.10 installer
# >>> conda init >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$(CONDA_REPORT_ERRORS=false '/Users/myusername/opt/anaconda3/bin/conda' shell.bash hook 2> /dev/null)"
if [ $? -eq 0 ]; then
    \eval "$__conda_setup"
else
    if [ -f "/Users/myusername/opt/anaconda3/etc/profile.d/conda.sh" ]; then
        . "/Users/myusername/opt/anaconda3/etc/profile.d/conda.sh"
        CONDA_CHANGEPS1=false conda activate base
    else
        \export PATH="/Users/myusername/opt/anaconda3/bin:$PATH"
    fi
fi
unset __conda_setup
# <<< conda init <<<

What can I do to fix this?

System: macOS

Upvotes: 0

Views: 690

Answers (1)

dom
dom

Reputation: 444

place source ~/.bash_profile into ~/.zsh

Bash loads .bash_profile during init, for zsh it’s .zsh

Default shell was changed from bash to zsh with macOS Catalina, so that’s why there is the problem.

Upvotes: 1

Related Questions