Skip to content

Instantly share code, notes, and snippets.

@florido
Forked from rcackerman/homebrew-python27.markdown
Created January 19, 2017 19:30
Show Gist options
  • Save florido/0a8e27140dc27d6713006ec413be4a40 to your computer and use it in GitHub Desktop.
Save florido/0a8e27140dc27d6713006ec413be4a40 to your computer and use it in GitHub Desktop.
Installing/updating Python 2.7 with Homebrew

Installing Python 2.7 with Homebrew

For Mac 10.8.x

1) Install XCode 4.4

Get it from the App Store.

2) Install Command Line Tools

In XCode's Preferences > Downloads you can install command line tools.

3) Let Everyone Know Where XCode Is

sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer

4) Install X11

Visit http://xquartz.macosforge.org/trac/wiki and download and install 2.7.5+.

You will need to fix the symlink it makes:

ln -s /opt/X11 /usr/X11

5) Install homebrew

ruby -e "$(curl -fsSkL raw.github.com/mxcl/homebrew/go)"

You may have to use sudo for this command.

6) Install python

brew install python --framework --universal

Mountain Lion will still use the system-installed python, in /usr/bin. You want the new homebrew-installed python to be called first.

open ~/.bashrc

Include

PATH=/usr/local/share/python:$PATH
export PATH

Check the right python is being used:

which python    # /usr/local/bin/python

Notes

You may need to specify the http proxy.

http_proxy=http://<proxyhost>:<proxyport>  brew install foo

Some useful hints for installing: https://github.com/mxcl/homebrew/wiki/Installation

1) Update X11

Current stable version is 2.7.5. Get it here: http://xquartz.macosforge.org/trac/wiki.

2) Homebrew updates

Probably everything's out of date, too.

brew update
brew outdated
brew upgrade

brew cleanup -s   #getting rid of old junk

Important: Remove /usr/local/share/python from your PATH.

3) Install Python3 if you want.

brew install python3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment