Skip to content

Instantly share code, notes, and snippets.

@scorphus
Forked from Bouke/gist:11261620
Last active September 16, 2015 21:29
Show Gist options
  • Save scorphus/c03f1912d75c0f501899 to your computer and use it in GitHub Desktop.
Save scorphus/c03f1912d75c0f501899 to your computer and use it in GitHub Desktop.
Brew multiple versions of Python

The brew versions command has been removed. The instructions are no longer valid.

Prerequisites

Make sure you don't have any Python 3.x installed:

$ brew uninstall python3

Then cd into your brew directory, this is /usr/local normally:

$ cd /usr/local

Then list all the available Python 3.x versions in Homebrew:

$ brew versions python3

Python 3.0

Sorry, not available with Homebrew.

Python 3.1

$ git checkout 0476235 Library/Formula/python3.rb
$ brew install python3
$ brew unlink python3
$ ln -s /usr/local/Cellar/python3/3.1.3/bin/python3.1 /usr/local/bin/python3.1

Python 3.2

$ git checkout 0f4a4af Library/Formula/python3.rb

This formula requires sqlite. In case it doesn't work or you don't want it installed, replace this line:

  depends_on 'sqlite'   => :optional  # Prefer over OS X's older version

by this:

  depends_on 'sqlite' => :build

Then install as usual:

$ brew install python3
$ brew unlink python3
$ ln -s /usr/local/Cellar/python3/3.2.3/bin/python3.2 /usr/local/bin/python3.2

Python 3.3

$ git checkout fedb343 Library/Formula/python3.rb
$ brew install python3
$ brew unlink python3
$ ln -s /usr/local/Cellar/python3/3.3.5/bin/python3.3 /usr/local/bin/python3.3

Python 3.4

$ git checkout 7d8b04c Library/Formula/python3.rb
$ brew install python3
$ brew unlink python3
$ ln -s /usr/local/Cellar/python3/3.4.3/bin/python3.4 /usr/local/bin/python3.4

Python 3.5

$ git checkout HEAD Library/Formula/python3.rb
$ brew install python3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment