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 http://peak.telecommunity.com/dist/ez_setup.py
$ sudo python ez_setup.py

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 – (http://oss.itsystementwicklung.de/trac/pysqlite/wiki/

$ python setup.py build
$ sudo python setup.py 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: http://trac.edgewall.org/wiki/TracDownload
and extract and install: sudo python ./setup.py 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 http://trac.edgewall.org/wiki/TracOnOsxTracdAsLaunchdService 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/mod_fastcgi.so

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

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”
    SSLRequireSSL
</Location>

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

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 to sjames111 Cancel reply

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

WordPress.com Logo

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

Google photo

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

Twitter picture

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

Facebook photo

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

Connecting to %s

%d bloggers like this: