Skip to content

Instantly share code, notes, and snippets.

@alanma
Created April 8, 2022 03:08
Show Gist options
  • Save alanma/b6846731573c003e4ad310bcdf99919d to your computer and use it in GitHub Desktop.
Save alanma/b6846731573c003e4ad310bcdf99919d to your computer and use it in GitHub Desktop.
Installing Anaconda with Homebrew

Installing Anaconda with Homebrew on a Mac

Install Homebrew

Run the following command on your terminal to install Homebrew. Homebrew is a package manager for Macs and is used to install useful development tools and software.

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Install Anaconda through Homebrew

  1. Run brew install --cask anaconda to install Anaconda
  2. Also run /opt/homebrew/anaconda3/bin/conda init zsh from your terminal
  3. Your ~/.zshrc should have the following section added
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/opt/homebrew/anaconda3/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
    eval "$__conda_setup"
else
    if [ -f "/opt/homebrew/anaconda3/etc/profile.d/conda.sh" ]; then
        . "/opt/homebrew/anaconda3/etc/profile.d/conda.sh"
    else
        export PATH="/opt/homebrew/anaconda3/bin:$PATH"
    fi
fi
unset __conda_setup
# <<< conda initialize <<<
  1. Run source ~/.zshrc from your terminal
  2. Type conda to ensure that anaconda linked correctly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment