Get it from the App Store.
In XCode's Preferences > Downloads you can install command line tools.
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
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.
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
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