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
AddHandler fastcgi-script .fcgi
ScriptAlias /trac /usr/local/Trac-0.11b2/cgi-bin/trac.fcgi
FastCgiConfig -initial-env TRAC_ENV=/usr/local/Trac-Projects/Projects”
SetEnv TRAC_ENV “/usr/local/Trac-Projects/Projects”
Allow from all