How do I use brew installed Python as the default Python?

sam picture sam · Mar 1, 2011 · Viewed 188.7k times · Source

I try to switch to Homebrew (after using fink and macport) on Mac OS X 10.6.2. I have installed python 2.7 with

brew install python 

The problem is that, contrary to Macport, it seems that there is no python_select utility, and my default mac python is always default

which python

give me

/usr/bin/python

and /usr/bin/python is not a symlink

How can I do to make python brew flavour to be my default python ?

Answer

Vishal picture Vishal · Sep 11, 2011

As you are using Homebrew the following command gives a better picture:

brew doctor

Output:

==> /usr/bin occurs before /usr/local/bin This means that system-provided programs will be used instead of those provided by Homebrew. This is an issue if you eg. brew installed Python.

Consider editing your .bash_profile to put: /usr/local/bin ahead of /usr/bin in your $PATH.