Command line tools comes bundle with Xcode prior to 4.3 version. After 4.3, you need to install a separated command line tools yourself.
First, go to this url and login using Apple Developer account (Free to register)
https://developer.apple.com/downloads/index.action
Look up the list and download the latest Command Line Tools for Xcode
Execute this command to install Homebrew
/usr/bin/ruby -e "$(/usr/bin/curl -fksSL https://raw.github.com/mxcl/homebrew/master/Library/Contributions/install_homebrew.rb)"
Or you've already have it, then execute this command to make sure it's updated
brew update
Homebrew website http://mxcl.github.com/homebrew/
Latest version of brew will install pip as default
brew install python
/usr/local/share/python/pip install --upgrade distribute
Add the following to .profile in your home folder
PATH=/usr/local/bin:/usr/local/share/python:$PATH
export PATH
Note: site-packages is in /usr/local/lib/python2.7/site-packages/
pip install virtualenv virtualenvwrapper
mkdir ~/.virtualenvs
Add the following to .profile in your home folder
export WORKON_HOME=$HOME/.virtualenvs
source /usr/local/share/python/virtualenvwrapper.sh
export PIP_VIRTUALENV_BASE=$WORKON_HOME
Create a new virtual environment by using
mkvirtualenv [your virtualenv name]
Note: --no-site-packages is deprecated since it is default, you won't need it any longer
Then start working on virtual environment by
workon [your virtualenv name]
PYTHON=/usr/local/bin/python brew install postgresql
initdb -A trust /usr/local/var/postgres
Using trust, you will use your login name on Mac OSX to login to PostgreSQL
Load Postgresql automatically when login
cp /usr/local/Cellar/postgresql/9.1.3/homebrew.mxcl.postgresql.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
Note: pg_hba.conf is in /usr/local/var/postgres/
pip install psycopg2
BUT if you want to use django-nose, you need to install psycopg2 version 2.4.1
pip install psycopg2==2.4.1
brew install PIL
pip install django
This command could verify the installation
python -c "import django; print(django.get_version())"