Installing Trac in Mac OS X Leopard Server

| Comments

Recently I’ve decided to dedicate one of my Mac OS X Server boxes to be a Subversion server. Now Subversion itself is great and there’s already a few GUI applications for OS X (Versions.app and Coda for example) that can help you view your Subversion repository quite easily. But what if you don’t have a wonderful application like Versions or Coda, or you’re on Windows or Linux for that matter?

Trac is an excellent answer and solution to that question. Trac is a web based front-end to subversion and much more (I only use it for viewing and comparing code changes visually). Straight from the Trac website:

Trac is an enhanced wiki and issue tracking system for software development projects. Trac uses a minimalistic approach to web-based software project management. Our mission is to help developers write great software while staying out of the way. Trac should impose as little as possible on a team’s established development process and policies.

It provides an interface to Subversion (or other version control systems), an integrated Wiki and convenient reporting facilities. Trac allows wiki markup in issue descriptions and commit messages, creating links and seamless references between bugs, tasks, changesets, files and wiki pages. A timeline shows all current and past project events in order, making the acquisition of an overview of the project and tracking progress very easy. The roadmap shows the road ahead, listing the upcoming milestones.

So how about getting it installed in OS X? It’s really really simple!

First, check to see which version of Python you have installed. You can do this by:

1
python --version

You should be okay, but just make sure you have at least version 2.3. I had version 2.5 which most people will have.

Next, download a copy of setuptools. You can visit this page:

http://pypi.python.org/pypi/setuptools#downloads

and snag ‘setuptools-0.6c9-py2.5.egg’. Although depending on which version of Python you get, make sure you get the right setuptool installer. Now, mine downloaded as setuptools-0.6c9-py2.5.egg.sh, I just removed the ‘.sh’ bit so it was just ‘setuptools-0.6c9-py2.5.egg’. Now, run this script as you would a shell script:

1
sudo sh ./setuptools-0.6c9-py2.5.egg

This will install a really fantastic thing called ‘easy_install’. Now, to actually install Trac, type in:

1
sudo easy_install Trac

BAM! You’re pretty much done if no error messages come up. A really good thing to see is installed tracd to /usr/local/bin/. Make sure you run the command with sudo since it’ll be install some pieces into areas normally restricted to non-admin accounts.

Once completed you can make yourself a Trac environment by typing in:

1
2
sudo trac_admin /path/to/trac/project initenv
ex. sudo trac_admin /usr/local/trac/myproject initenv

This will add a new Trac project to your server. To start up the Trac server use:

1
sudo tracd -p 81 /usr/local/trac/myproject

You can now open a web browser and browse to http://127.0.0.1:81 and you should see your project listed!

Now let me breakdown that command to startup tracd. ‘tracd’ is the server binary, so you obviously need that, the -p 81 means it’ll run on port 81, I chose 81 since my webserver is using port 80 already and then I give the path to the project I want hosted. Do note, you can list multiple project paths, I have about 7-8 listed in my startup command.

By default tracd will only listen on your local loopback IP address (127.0.0.1) which is nice if you only need to access it locally but I am 2000 miles from my server so I need to access it externally. This can easily be accomplished by using the ‘–hostname=’ parameter.

This should pretty much cover a basic Trac install on OS X Server. Beyond this, you can create a LaunchDaemon for tracd so that it starts when your server starts and something very important is authentication and permissions. I haven’t gone into detail on either of those items in this article, but if anyone is interested, I’d be more then willing to share that information! I highly recommend checking out the Trac website as well!

Comments