mountain lion homebrewを入れて、Pythonを更新する

そういえばbrew入れてないなと思い、入れてみた。
本家の下の方にあるワンライナーをコピーしてターミナルにペーストし、実行。
あっさりインストール完了。

$ brew doctor
Your system is raring to brew.

$ brew update
Initialized empty Git repository in /usr/local/.git/
remote: Counting objects: 75914, done.
remote: Compressing objects: 100% (36999/36999), done.
remote: Total 75914 (delta 51550), reused 60027 (delta 38100)
Receiving objects: 100% (75914/75914), 10.80 MiB | 1.37 MiB/s, done.
Resolving deltas: 100% (51550/51550), done.
From https://github.com/mxcl/homebrew
 * [new branch]      gh-pages   -> origin/gh-pages
 * [new branch]      go         -> origin/go
 * [new branch]      master     -> origin/master
HEAD is now at dc4c40b tests: require string extension before exceptions
Already up-to-date.

これで準備OK。

mountain lionにデフォルトで入っているPythonが2.7.2だった。

$ brew search python
mod_python   python	  python3
homebrew/versions/python24		homebrew/versions/python26
homebrew/versions/python25		homebrew/versions/python31

$ brew info python
python: stable 2.7.3
http://www.python.org/
...

brewで2.7.3が入れられるみたいなので入れてみる。

$ brew install python
Unsatisfied dependency: XQuartz 
Please install the latest version of XQuartz:
  https://xquartz.macosforge.org
Error: An unsatisfied requirement failed this build.

エラーが出た。
XQuartz入れろと言われている。
XQuartzはXウインドウシステムらしいので https://xquartz.macosforge.org から落としてきて入れてみるた。
もう一度挑戦。

brew install python
==> Installing python dependency: gettext
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/gettext-0.1
######################################################################## 100.0%
==> Pouring gettext-0.18.1.1.mountainlion.bottle.tar.gz
==> Caveats

...

See: https://github.com/mxcl/homebrew/wiki/Homebrew-and-Python
==> Summary
/usr/local/Cellar/python/2.7.3: 5165 files, 80M, built in 2.1 minutes

$ python --version
Python 2.7.2

インストールできたけど、どうやらPATHが通っていない。
.zhrcに

export PATH=/usr/local/bin

追記して

$ source .zshrc
$ python --version
Python 2.7.3

これでPythonが2.7.3になりました。