Install of Python dev environment on OSX

After much trial and error, this is what worked for me on a macbook pro, running snow leopard 10.6.6.

$ brew install python
$ sudo easy_install pip
$ pip install virtualenv
$ pip install virtualenvwrapper 
$ vi ~/.profile
   # add this line to .profile
   source /usr/local/Cellar/python/2.7.1/bin/virtualenvwrapper.sh

$ source ~/.profile

First install a current Python (OSX python is outdated).

Then use easy_install to install its replacement: pip. (use pip after this)

Then use pip to install virtualenv and virtualenvwrapper (python's env manager.  Think Ruby rvm)

The docs for virtualenvwrapper are at http://www.doughellmann.com/docs/virtualenvwrapper/

Example of creating python env

$ mkvirtualenv env-0
New python executable in env-0/bin/python
Installing setuptools............................done.
virtualenvwrapper.user_scripts creating /Users/sam/.virtualenvs/env-0/bin/predeactivate
virtualenvwrapper.user_scripts creating /Users/sam/.virtualenvs/env-0/bin/postdeactivate
virtualenvwrapper.user_scripts creating /Users/sam/.virtualenvs/env-0/bin/preactivate
virtualenvwrapper.user_scripts creating /Users/sam/.virtualenvs/env-0/bin/postactivate
virtualenvwrapper.user_scripts creating /Users/sam/.virtualenvs/env-0/bin/get_env_details

$ ll $WORKON_HOME
total 88
drwxr-xr-x  5 sam  staff   170 Mar 25 08:22 env-0
-rwxrwxr-x  1 sam  staff   106 Mar 25 08:18 get_env_details
-rw-r--r--  1 sam  staff  4082 Mar 25 08:33 hook.log
-rwxrwxr-x  1 sam  staff    92 Mar 25 08:18 initialize
-rwxrwxr-x  1 sam  staff    69 Mar 25 08:18 postactivate
-rwxrwxr-x  1 sam  staff    71 Mar 25 08:18 postdeactivate
-rwxrwxr-x  1 sam  staff    69 Mar 25 08:18 postmkvirtualenv
-rwxrwxr-x  1 sam  staff    63 Mar 25 08:18 postrmvirtualenv
-rwxrwxr-x  1 sam  staff    70 Mar 25 08:18 preactivate
-rwxrwxr-x  1 sam  staff    72 Mar 25 08:18 predeactivate
-rwxrwxr-x  1 sam  staff    94 Mar 25 08:18 premkvirtualenv
-rwxrwxr-x  1 sam  staff    64 Mar 25 08:18 prermvirtualenv