Setting up trac on OSX

Yeowch that was harder work than it should have been.

Firstly I have installed ‘stuff’ before via port,  NEVER again (well almost never).  Darwin port installs apps into /opt/… it will manage the dependencies of an installation (but removing an app does not remove the dependencies).  I had managed to get several versions of python installed, a seemingly harmless situation, more of that later.

I already had subversion installed and integrated with apache2 (per my previous post).  To install trac I had to add a few dependencies:

Firstly add setup tools ;
$ wget
$ sudo python

Here game the problem, as I had installed something via port that installed python (and I had /opt/local/bin in my path) it was installing into port’s python’s site directory.  As _www is the user that runs apache, it was running python from osx’s default thus none of these dependencies were installed.    The solution was to add /opt/local/bin to the END of my path so that port apps are picked up only if there is a non osx version and to rerun the installs.

pysqlite-2.4.1 – (

$ python build
$ sudo python install

Genshi & Pygments

sudo easy_install Genshi
sudo easy_install Pygments

You may like to install clearsilver (I did not) its required for some trac modules.  I may get to this later.

Now to install trac download trac from here:
and extract and install: sudo python ./ install

This will put the relevent modules into the site directory and some scripts into /usr/local/bin (make sure this is in your path).

Now to setup trac,  I have a single svn repository /usr/local/Subversion/Projects so to match this I created a Trac project /usr/local/Trac-Projects/Projects

$ sudo trac-admin /usr/local/Trac-Projects/Projects initenv

And follow the prompts

At this point you can run trac server directly

$ tracd –port 8000  ../../Trac-Projects/Projects/

This allows you to test the installation,  if you want to run trac in this way look at for instructions as to how to set it up via lanchd.  I wanted to use apache2.

So to /etc/apache2/other (again)

create a file called trac.conf containing:

LoadModule fastcgi_module libexec/apache2/

# Enable FastCGI for .fcgi files
<IfModule fastcgi_module>
    AddHandler fastcgi-script .fcgi
    FastCgiIpcDir /var/run/fastcgi

ScriptAlias /trac /usr/local/Trac-0.11b2/cgi-bin/trac.fcgi
FastCgiConfig -initial-env TRAC_ENV=/usr/local/Trac-Projects/Projects”

<Location “/trac”>
    SetEnv TRAC_ENV “/usr/local/Trac-Projects/Projects”

<Directory “/usr/local/Trac-0.11b2/cgi-bin/”>
    AllowOverride None
    Options None
    Order allow,deny
    Allow from all

4 thoughts on “Setting up trac on OSX

  1. Wupse 2 more changes required .. one I did not secure it (thats next) more importantly I kinda hacked the location of the CGI, I had copied the install into usr/local which is kinda sucky.
    Better solution is to mkdir cgi-bin in Trac-Projects then cp the cgi-bin/* files from the distro and update the conf to point to the right place.

  2. The authentication was easy, trac just uses the credentials for basic auth
    as I had a domain setup for subversion I reused that .. the location above was changed too:

    SetEnv TRAC_ENV “/usr/local/Trac-Projects/Projects”
    AuthType Basic
    AuthName “Scott Subversion”
    AuthUserFile /usr/local/subversion/svn-auth-file
    Require valid-user

  3. This is for home, well mostly.. I am trying to get CS to retool from clearcase to something less shit. It kinda helps that I can speak with some personal experience but mostly hell yea its a PITA!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: