Amending PATH so that /usr/local/bin is ahead of /usr/bin

I'm trying to install brew but get the following warning:

Warning: /usr/bin occurs before /usr/local/bin
This means that system-provided programs will be used instead of those
provided by Homebrew. The following tools exist at both paths:

2to3
2to3-2.7
idle
idle2.7
pydoc
pydoc2.7
python
python-config
python2.7
python2.7-config
pythonw
pythonw2.7
smtpd.py
smtpd2.7.py

Consider amending your PATH so that /usr/local/bin
is ahead of /usr/bin in your PATH.

I have no idea how to amend the path. I've explored several files from this stack overflow post (http://stackoverflow.com/questions/8886114/using-brew-with-ruby-1-9-2), but can't find a relevan path to edit. The only file that I do have that exists is my /etc/profile file which currently looks like:

# Setting PATH for Python 2.7
# The orginal version is saved in .bash_profile.pysave
    PATH="/Library/Frameworks/Python.framework/Versions/2.7/local/bin:${PATH}"
export PATH

I wanted to just uninstall python then reinstall it through homebrew, but am a little nervous about breaking too many things at once.

Is there an easy way to amend the path? Should I create a .bash_profile file? Thank you for any help in advance.


Solution 1:

Yes, create a .bash_profile file in your home directory containing

PATH="/usr/local/bin:$PATH"

and then do one of the following to make the change active

  • execute . ~/.bash_profile
  • execute PATH="/usr/local/bin:$PATH" in the current shell
  • restart Terminal

Solution 2:

You need to amend /etc/paths so that /usr/local/bin is listed before /usr/bin. You'll need to sudo your editor in order to do that.

One of the ways to open editor is

 sudo open -t /etc/paths