I’m always using the Homebrew to install the dependencies needed. For recent studies, I need Anaconda for learning python developments. So the first step is trying to install it with homebrew by brew cask install anaconda, but get this warn information while installing:

Cask anaconda installs files under /usr/local. The presence of such files can cause warnings when running "brew doctor", which is considered to be a bug in Homebrew-Cask.

To fix this bug, you need to add the /usr/local/anaconda3/bin directory to the PATH environment variable. Simply put this in terminal:

echo 'export PATH="/usr/local/anaconda3/bin:$PATH"' >> ~/.bash_profile

However, I don’t even maintain a .bash_profile on my computer. So I wonder there is another better solution for me. Eventually, there it is!

Just open your /etc/paths file with your favourite editor using sudo permissions, and add /usr/local/anaconda3/bin to it:

sudo code /etc/paths

/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin
/usr/local/anaconda3/bin

After saving the /etc/paths file, then RESTART THE TERMINAL (close with cmd+Q, then reopen Terminal). Now you can check the python3 is installed with Anaconda as Python 3.6.4 :: Anaconda, Inc.. Now you can check the updated python version with python --version or python3 --version.