Version 24 (modified by anonymous, 18 years ago) ( diff )

--

Development (Mac OS X Tiger)

Originally written by Ben Atkin

These instructions are for Django 0.91. I hope to update this with most new releases.

I prefer the latest tarballs for general development. If I ever start to get really into the software I get the CVS or SVN.

Before beginning, install XCode. XCode contains make, gcc, and other things you'll be needing when compiling from source.

As an alternative to these instructions, consider installing DarwinPorts. It simplifies installing up-to-date versions of apache2, python 2.4, mod_python, PIL, and the various databases that Django supports. A write up walking through the packages to install with DarwinPorts to get a quick install running is available at http://www.rhonabwy.com/wp/2006/07/20/installing-django-on-macos-x-development-version/

Installing Python

  1. Download and unpack latest stable python tarball
  2. ./configure --prefix=/opt/python; make; make install
  3. Add export PATH=/opt/python/bin:$PATH and export MANPATH=/opt/python/man:$MANPATH to ~/.profile
  4. Open a new terminal session
  5. Type python and check that it is the version you just installed

Installing PostgreSQL

  1. Create a new user, postgres in the Accounts Pane of the Mac OS X System Preferences
  2. Download and unpack latest stable PostgreSQL tarball
  3. ./configure --prefix=/opt/pgsql; make; sudo make install
  4. Add export PATH=/opt/pgsql/bin:$PATH and export MANPATH=/opt/pgsql/man:$MANPATH to ~/.profile
  5. Add export PGDATA=/opt/pgsql/data to ~/.profile NOTE: If this isn't set, postgres will complain about a missing conf file.
  6. Open a new terminal session
  7. Type psql -V and check that it is the version you just installed
  8. Create a data directory: sudo mkdir $PGDATA
  9. Change ownership to postgres: sudo chown postgres:postgres $PGDATA
  10. Create the initial data area: sudo -u postgres initdb -D $PGDATA NOTE: sudo means substitute user and do, and in this case with the initial -u parameter, we are telling sudo to run the command as postgres rather than root.
  11. To run the database (will not be automatically started on boot): sudo -u postgres pg_ctl start
  12. Open a new window, and type sudo -u postgres createdb test. If it says CREATE DATABASE, it's working. :)

Installing psycopg (PostgreSQL Bindings)

At the time of this writing, the only stable version of psycopg is psycopg1. The development version psycopg2 is not supported by Django.

  1. Download the latest stable tartball of mxDateTime
  2. Unpack the tarball and go into the directory
  3. python setup.py build
  4. sudo python setup.py install
  5. Download the latest stable tarball of psycopg1, unpack and go into the directory
  6. export MACOSX_DEPLOYMENT_TARGET=10.4
  7. export CPPFLAGS="-I/opt/python/lib/python2.4/site-packages/mx/DateTime/mxDateTime"
  8. ./configure --with-postgres-libraries=$(pg_config --libdir) --with-postgres-includes=$(pg_config --includedir)
  9. make
  10. sudo make install
  11. Run python, type import psycopg into the interactive read-eval-print loop (REPL), and quit the REPL.

I had some issues with the above instructions for installing psycopg, and had to refer directly to the untarred installation source for mxDateTime in order to get the headers. To do this change the configure command to:

./configure --with-postgres-libraries=$(pg_config --libdir) --with-postgres-includes=$(pg_config --includedir) --with-mxdatetime-includes=[path/to/mxdatetime]/egenix-mx-base-2.0.6/mx/DateTime/mxDateTime

Darwin Ports way

Alternative method for installing psycopg is using the darwin ports

  1. sudo port install py-egenix-mx-base
  2. sudo port install py-psycopg

Darwin ports are available at http://darwinports.opendarwin.org/

Note: See TracWiki for help on using the wiki.
Back to Top