Introduction: Having Python 3 in OSX Without Messing Up the Existing Python

You have python 2 pre-installed in OSX. But you want to have python 3 running alongside with it, so you don't mess up things that rely on the python 2. Here's how to do that!

Step 1: Install Homebrew

Install homebrew, the free missing package manager for OSX. You’re gonna want it anyway. Simply type this command in your OSX terminal (ruby is installed in your default OSX):

ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”


Step 2: Update Homebrew

Still in the OSX Terminal, update homebrew by typing this command at the prompt:

brew update

Step 3: Install Python 3

Still in the OSX Terminal, type this command:

brew install python3

Voila! You now have two different commands at your disposal: python and python3. You now also have pip3.

Henss-MBP:~ henszimmerman$ python3

Python 3.4.2 (default, Dec 21 2014, 10:52:15)

[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.56)] on darwin

Type “help”, “copyright”, “credits” or “license” for more information.

>>>