I just installed Python 3.6 from python.org on macOS Sierra.

Somehow, the path to python's bin is added to my every $PATH but I can't figure out how:

22:15 : echo $PATH                                                                          

Now, /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin is the default value in my /etc/paths and the X11, git and TeX parts come from the 3 files in /etc/paths.d/. But I have no Python-related file in /etc/paths.d/.

And there is nothing related to Python in my ~/.zshrc.

Does anyone know where the Python bit of $PATH is coming from?

  • hat is in ~/.zprofile and ~/.zlogin and does this PATH show in a new shell? and what is in ~/.bashrc
    – mmmmmm
    Commented Mar 19, 2017 at 18:37
  • What are the results of cd; grep 'PATH' .z*?
    – fd0
    Commented Mar 19, 2017 at 19:18
  • @Mark: bingo, Python modified (actually created) ~/.zprofile!! If you make it an answer I'll accept it. Commented Mar 20, 2017 at 2:55

2 Answers 2


zsh reads from up to 4files on start up

If ZDOTDIR is not set, then the value of HOME is used; this is the usual case.


You need to look in all of them.

.zshrc is read every time a shell or sub shell is started. .zprofile is read when you start a login shell - ie the first shell you start through terminal, and this is where I would put the PATH changes


Check ~/.bashrc or ~/.bash_profile

  • .bash_profile (.bashrc isn't common on macOS) is specific to Bash; the OP appears to be using Zsh.
    – John N
    Commented Mar 19, 2017 at 19:30
  • 1
    Last time I had the same issue, I found I sourced bashrc in zshrc
    – xhg
    Commented Mar 19, 2017 at 19:31
  • @aahung zsh and bash languages differ .bashrc might cause syntax erros - much better to keep them separate
    – mmmmmm
    Commented Mar 19, 2017 at 20:19
  • You made a point. It was long time ago I did this when I was not familiar and chased convenience. And recently I notice when I installed a new version of Python, the installer append to bash-files instead of zsh-files. Maybe he/she has the similar situation
    – xhg
    Commented Mar 19, 2017 at 20:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .