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
ruby <(curl -fsSkL raw.github.com/mxcl/homebrew/go)
Homebrew website http://mxcl.github.com/homebrew/
brew install python
At this point, distribute and pip will also be installed by above command.
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/bin/virtualenvwrapper.sh
export PIP_VIRTUALENV_BASE=$WORKON_HOME
Create a new virtual environment by using
mkvirtualenv [your virtualenv name]
or create a new virtualenv without any existing libraries
mkvirtualenv --no-site-packages [your virtualenv name]
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
initdb /usr/local/var/postgres -E utf8
Load Postgresql automatically when login (** DO NOT FORGET to change Postgresql version number below to match the current version of Postgres)
mkdir -p ~/Library/LaunchAgents
cp /usr/local/Cellar/postgresql/9.1.4/homebrew.mxcl.postgresql.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
Login to Postgresql using your Mac OSX login name
Note: pg_hba.conf is in /usr/local/var/postgres/
Useful commands
Start Postgresql Server manually
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
Stop Postgresql Server manually
pg_ctl -D /usr/local/var/postgres stop -s -m fast
Install this inside virtual environment to connect Django with Postgresql database server
pip install psycopg2
pip install django
@johnrees Sorry I'm a Mac newbie, and a little help would go a long way in this case! Thanks for addressing chuender's issue. I'm a bit confused on how to set python to my PATH. The last line of "brew info python" is a link to
https://github.com/mxcl/homebrew/wiki/Homebrew-and-Python
Seems like an informational page that brags a lot about how with Homebrew you don't need to set the PATH.