Thursday, March 1, 2012

How to make Homebrew's Python the default version

I am trying out Homebrew and the Python that comes with it. I was having the problem that when I try to run Homebrew's python in the shell, I ended up running the outdated python that comes with OS X instead.

Here is how to make sure that Mac uses the homebrew python instead of the version shipped with OS X.

I am assuming you are using bash. To find out which shell you are using, type:
 echo $SHELL  
I am also assuming you installed homebrew in /usr/local (the default installation directory).

Now, edit the file .bash_profile (e.g. using nano) in your home directory and add the following line in the end of the file:

 # Homebrew Python instead of Apple's  
 export PATH=/usr/local/bin:/usr/local/share/python:$PATH  

Now restart your terminal and there you go!

No comments:

Post a Comment