Edgewall Software

Installing Trac on Mac OS X, without Fink or MacPorts

Subversion the easy way

If you are using Python 2.5.x (from http://python.org/download/ or pre-installed on Leopard) and either use Apache 2.2.4 or don't need mod_dav_svn, your best bet is going to be get the opencollab precompiled Subversion. It has a nice installer and in my experience just works. You will still need to install the other prerequisites as detailed in the section after next.

Its Python modules seem to work with Python 2.3.5 on Tiger but emit several warnings about a C API mismatch on startup. They still pass the Trac tests though. If you want seamless integration with 2.3 or Apache 2.0, read on.

Subversion the slightly harder way

These instructions are written specifically for building Python 2.3 bindings when you have another Python (say 2.5) installed as default. Adjust the instances of Python 2.3 for another Python as appropriate (specify path if necessary). This will install under /usr/local which allows it to coexist with the opencollab bindings, above.

Note 1: These steps require using the Terminal (/Applications/Utilities/Terminal.app). Some basic commands are left out, namely extracting (for .tgz or .tar.gz, tar -xvzf FILENAME_HERE; for .tbz2 or .tar.bz2, tar -xvjf FILENAME_HERE) and directory changing. You also must be in the admin group, so you can run sudo. If you need help with these steps, just hop on our IrcChannel.

Note 2: if you have a muscle memory to use wget to download things, you can either install it or set up a quick bash function that'll do the equivalent with curl:

$ alias wget="curl -O"

Note 3: If you want to use Apache 2.0, go ahead and build it separately. You will lose the ability to start/stop it in the Sharing pane though. Apache 2.2 comes with Leopard and mod_dav_svn can evidently be built against that without recompiling Apache. However the package above comes with a precompiled 2.2 module that may work.

Let's begin.

  1. If you're on Tiger, get the XCode 2.4.1 dmg (free ADC login required, check bugmenot) and install it. XCode 2.5 seems to have a broken/missing libtool on Tiger. If on Leopard, use XCode 3.0, it should work correctly. (FIXME Verify)
  1. Download and build SWIG.
$ ./configure --with-python=python2.3
$ make
$ sudo make install

With version 1.3.34, this took under 4 minutes on a lowly G4.

  1. Download and extract both subversion and subversion-deps from the same folder. They will end up overlaying.
$ ./configure --without-berkeley-db --with-ssl --with-zlib PYTHON=python2.3
$ make
$ make swig-py
$ sudo make install install-swig-py

The configure step is recursive and may look like it is looping. Just let it sit for a while and expect a message at the end of configure about not being build with bdb support. That's fine, you don't want bdb anyway!

If you want to build mod_dav_svn, you need to add some additional arguments here, check the Apple install doc for examples as you will want to use the apxs and apr options from it.

With Subversion 1.4.6, the make steps took approximately 15 minutes each on a lowly G4.

  1. Add the svn bindings to your $PYTHONPATH. The easiest way to do this is detailed in the install doc for Subversion:
$ echo /usr/local/lib/svn-python > /Library/Python/2.3/site-packages/svn-python.pth

If you are not using the bundled 2.3, figure out where your site-packages directory lives:

$ python -c 'import site; print site.sitedirs[0]'

Other prerequisites

  1. setuptools (required for 0.11, doesn't hurt for 0.10):
$ wget http://peak.telecommunity.com/dist/ez_setup.py
$ sudo python2.3 ez_setup.py

Then add /System/Library/Frameworks/Python.framework/Versions/2.3/bin to the end of your path (presuming you want a coresident 2.5 to be primary, and will suffix all commands with the Python version).

echo 'PATH="${PATH}:/System/Library/Frameworks/Python.framework/Versions/2.3/bin"' >> ~/.bash_profile
echo 'export PATH' >> ~/.bash_profile

Do not forget the doubled greater-than, otherwise you'll overwrite existing commands in your .bash_profile. Now type source ~/.bash_profile to make it take effect immediately.

  1. pysqlite2 (both 0.10 and 0.11) can build against the bundled libsqlite3 on Tiger. Download the sources, extract, and run:
$ python2.3 setup.py build
$ sudo python2.3 setup.py install

This just takes less than a minute with pysqlite 2.4.1 on a G4.

  1. Clearsilver (0.10):
$ ./configure --prefix=/usr/local --disable-ruby --with-python=`which python2.3`
$ make
$ sudo make install
$ sudo python python/setup.py install

The make step will take approximately a minute to complete. If you do not supply the full path to a python binary, it will fall back to a broken section of configure (at least using clearsilver 0.10.5) which will result in site-packages being in the install path twice.

Note: On Intel-Based Mac's running Leopard, you may need to configure with "./configure —build=i386 —with-python=which python —disable-ruby" if it fails to guess the architecture of neo_cgi.so during make.

  1. Genshi (0.11):
$ sudo easy_install-2.3 Genshi
  1. Pygments for syntax highlighting (0.10 with TH:TracPygments plugin, automatic on 0.11):
$ sudo easy_install-2.3 Pygments

Subversion the old way

These are advanced instructions. You should be familiar with the Terminal, the standard configure/make process, and be intimately aware of what python versions you have on your system and the order they are in your path. If you're using Tiger/Leopard and want a simpler solution, scroll back up.


I have found that trying to install Trac and all its dependencies, notably Subversion and the swig bindings, on OS X 10.3 without using Fink, to be surprisingly difficult and full of caveats. With some perseverance, and considerable help from kind folks on the Trac and Subversion users lists, I have succeeded. In the hope that this may help others, I am documenting here what has worked for me.

This procedure intentionally specifies that subversion be installed without Berkeley DB, thus svn repositories will be only FSFS, as per current recommendation.

The details here are quite tightly bound to the specific version of each package installed, and therefore are likely to change quickly. Please take this into account, and do not follow them blindly! Also, if you discover any incorrectness, or obsoleteness, please be so kind as to either update this document yourself, or just contact me on mario@… about it.

You should allow yourself a comfortable hour or so for this installation procedure.

Requirements

  • Apache 1.3, the one bundled with OS X 10.3
  • Python, use the stock python 2.3 that comes with your OS X 10.3 system (in /usr/bin/python)
  • neon, version 0.25.x (0.25.3 is OK)
  • swig, version = 1.3.21, and not 1.3.24 !
  • Subversion, version 1.x.x (1.2.3 is OK) (1.4 not recommended with XCode ⇐ 2.4 see below)
  • SQLite, version 3.x.x (3.2.5 is OK)
  • PySQLite, version 1.1.6, and not 2.0 and up
  • Clearsilver, version 0.9.14, and not 0.10.1
  • docutils, version 0.3.x (0.3.9 is OK)
  • trac, version 0.8.x

Andrew Durdin says: I'm using OS X 10.4, and successfully installed Trac with the following library versions (somewhat contrary to the notes above):

Trac0.9.5
Apache1.3.33 (as installed with OS X 10.4
Python2.3.5 (as installed with OS X 10.4
Swig1.3.29
Subversion1.3.1 (source tar includes neon and APR)
SQLite3.1.3
PySQLite2.2.2
Clearsilver0.10.3
docutils0.4

Paul Yu says: I'm using OS X 10.4.7 Server, and successfully installed Trac with the following library versions:

Trac0.9.6
Apache1.3.33 (as installed with OS X 10.4)
Python2.3.5 (as installed with OS X 10.4)
Swig1.3.29
Subversion1.3.2 (source tar includes neon and APR)
SQLite3.3.7
PySQLite2.3.2
Clearsilver0.10.3
docutilsLatest snapshot (8/17/2006)

I did have to mv /usr/lib/libsqlite3.0.dylib and /usr/lib/sqlite3 (directory) to *.old. This overcame a problem with the PySQLite installation and test. see this link. http://lists.initd.org/pipermail/pysqlite/2006-April/000484.html

Nico C (2007-07-23) says: Successfully installed on OS X 10.4.10 (Xcode 2.4.1 installed) with these versions:

Trac0.10.4
Apache1.3.33 (as installed with OS X 10.4)
Python2.3.5 (as installed with OS X 10.4)
Swig1.3.31
Subversion1.4.4 (don't forget to install 'subversion-deps' wich includes neon and APR)
SQLite3.4.0
PySQLite2.3.4
Clearsilver0.10.5
docutils0.4

Ryan Morales (2008-03-10) says: Successfully configured Trac 0.10.4 on MacOSX 10.4.10 with Xcode 2.5 installed:

Apache2.2.6
APR1.2.8
APR-UTIL1.2.8
neon0.25.3
swig1.3.31
subversion1.4.4 (I used universal.dmg)
python2.3 (provided by MacOSX)
sqlite3.4.0 (add sqlite.c and sqlite.h from sqlite-3.5.6 to sqlite directory upon configuration)
pysqlite2.3.4
clearsilver0.10.5
docutils0.4

I'm running Trac with the supplied tracd server, because the Apache installed by Apple doesn't include mod_python.

Preliminaries

no fink

Preferably you do not have fink in your environment, to avoid that the various configure scripts pick up libraries to link to from under fink. So, make sure that your env path does not include any /sw dirs, and that the file /sw/bin/init.sh is not being executed from anywhere in your .profile.

tar over zip

When downloading the various packages, and have the choice between zip or tar source archives, prefer the tar distributions as zip has sometimes given carriage return problems, resulting in bizarre errors later on.

clean-up

Note: you may prefer to do this clean-up step only if a first installation attempt fails.

Clean out any previously installed libs and executables prior to doing the installation process. The files to remove (or rename) are:

sudo rm -rf /usr/local/apr
sudo rm -f /usr/local/lib/libneon*
sudo rm -f /usr/local/lib/libsvn*
sudo rm -f /usr/local/lib/pkgconfig/neon.pc
sudo rm -f /usr/local/bin/swig 
sudo rm -f /usr/local/bin/neon-config
sudo rm -f /usr/local/bin/svn*
sudo rm -rf /usr/local/bin/subversion-1

Plus, if you happen to have any previous installations of the swig svn python bindings in your site packages, then remove (or rename) them:

sudo rm -rf /Library/Python/2.3/libsvn
sudo rm -rf /Library/Python/2.3/svn

Installing the Packages

I will only describe the essentials that are particular to OS X, and to installing without Fink. Please substitute any steps not detailed here with their generic equivalents in TracInstall.

neon

In theory you should not need to install this separately, but doing so may avoid some confusing warnings when installing subversion, due to missing entry for darwin in the neon configure script (the neon currently bundled with subversion). See this note on the svn users list as to why we may want to install neon separately.

  • Get latest source tarball from (http://www.webdav.org/neon/):
    cd <neon-distribution-top-dir>
    ./configure --with-ssl 
    make
    sudo make install
    
  • For OS 10.4, if it doesn't install try commenting out NE_HAVE_I18N and HAVE_TIMEZONE in config.h

swig

The latest version of swig (1.3.24) will not work! You need version 1.3.21, as stated in this message on the svn users list: "subversion 1.1.x currently REQUIRES swig ≥ 1.3.19 and ⇐ 1.3.21. Swig1.3.24 is _not_ supported."

  • Get source tarball for 1.3.21 from (http://www.swig.org/)
  • See the generalized INSTALL procedure, from which highlights are extracted below:
    cd <swig-distribution-top-dir>
    ./configure --with-python=/usr/bin/python
    make 
    make runtime
    sudo make install
    sudo make install-runtime
    

subversion

Get latest source tarball from (http://subversion.tigris.org/). Note that you may get a prepared package for subversion from (http://www.codingmonkeys.de/mbo/), thanks to Martin Ott. You probably will still need the tarball above though for compiling the python bindings. Note: The Ott package does not have everything that is needed to work with Trac, so it is better to just follow the make install instructions below. I was able to install Ott's package and then make install from the source with no ill effects.

For 10.3:

cd <subversion-distribution-top-dir>
./configure --with-zlib --with-ssl --with-neon=/usr/local --without-berkeley-db --enable-swig-bindings=python --with-swig=/usr/local/bin/swig PYTHON=/usr/bin/python
make
sudo make install

For Mac OS X 10.4, the following works:

cd <subversion-distribution-top-dir>
GXX=yes ./configure --without-berkeley-db --enable-swig-bindings=python --with-swig=/usr/local/bin/swig PYTHON=/usr/bin/python PYTHON2=/usr/bin/python2.3
make
sudo make install

Note: make sure you download the tar archive as the zip (for subversion 1.2.3) gave problems with carraige returns, specifically in the file ac-helpers/install-sh. You should see something like the output below (no bizarre chars) when you do:

$ grep -n ^# ac-helpers/* | grep ':1:' | grep /bin/sh | cat -vte
ac-helpers/config.guess:1:#! /bin/sh$
ac-helpers/config.sub:1:#! /bin/sh$
ac-helpers/install-sh:1:#!/bin/sh$
ac-helpers/install.sh:1:#!/bin/sh$

COMPATIBILITY: Subversion 1.4 has changed the format of the .svn/entries files in a way that XCode version ⇐ 2.4 does not understand. Your options are as follows:

swig svn python bindings

For 10.3 do:

cd <subversion-distribution-top-dir>
make swig-py
sudo make install-swig-py
echo /usr/local/lib/svn-python > /Library/Python/2.3/svn-python.pth

For 10.4 do:

cd <subversion-distribution-top-dir>
make swig-py
sudo make install-swig-py
echo /usr/local/lib/svn-python > /Library/Python/2.3/site-packages/svn-python.pth

sqlite, pysqlite

  • Get sqlite latest source tarball from (http://www.sqlite.org/) and pysqlite latest source tarball from (http://pysqlite.org/)
  • Follow their respectives installation instructions.
  • NOTE (sqlite): The sqlite OS X install instructions that I found said to configure with the '—disable-shared' option, claiming that OS X's libtool is busted and thus generates bad dynamic/shared libraries. However, disabling shared libraries generated an error during the make install step, because one of the install scripts looks for a shared library (identified by extension .dylib) regardless of the configure options. So, in good UNIX fashion, I ignored the instructions and tried it with the shared libraries. I did a 'make test' and all the regression tests passed, so it seems that the problem with libtool has been fixed and '—disable-shared' is no longer necessary.
  • NOTE (pysqlite): The build step ('python setup.py build') failed with a "No such file or directory" error on "/opt/local/lib". I opened up setup.py and found that for OS X (and only OS X), it sets the lib path to /opt/local/lib. On my system, this was wrong, so I changed it to /usr/local/lib.
  • NOTE (pysqlite): Just to clear up any confusion regarding API versions - and this probably only applies if you're going to use SQLite 3, either installed by hand or as shipped with OS X 10.4 - PySQLite v2.0x will not work with Trac (as of 0.9-pre). Instead, get the latest stable 1.1.x (1.1.6 as of this writing) version. DO NOT install PySQLite 2.x as it is a new version that will not work with Trac.

clearsilver

  • Get the 0.9.14 (not the latest) tarball from (http://www.clearsilver.net/)
  • Installation procedure slightly different from those given by TracOnOsx:
    cd <clearsilver-distribution-top-dir>
    ./configure --prefix=/usr/local --with-python=/usr/bin/python --disable-ruby
    make
    # >>> here modify first line of scripts/document.py to use same python 
    sudo make install 
    

2007-11-06 Andy W says: I have been using clearsilver 0.10.4 successfully on OS-X 10.4 installations. But On OS-X Server 10.4.10 (i386), clearsilver 0.10.4 could not build neo_cgi.so. Clearsilver 0.10.5 built and installed neo_cgi.so, but put it in a funky directory /System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/site-packages (note the double site-packages). When I moved the library to just python2.3/site-packages, it worked.

2008-03-14 Zach says: Run "sudo python python/setup.py install" after "sudo make install" and it installs to the right location. Also, On Intel-Based Mac's running Leopard (And maybe Tiger Server from Andy's error message), you may need to configure with "./configure —build-i386 —with-python=which python —disable-ruby" if it fails to guess the architecture of neo_cgi.so during make. It defaults to /usr/local, so theres no need to tell it to install there.

docutils

trac

  • Standard setuptools installation
  • Will put executables and shared files in:
    /System/Library/Frameworks/Python.framework/Versions/2.3/bin/trac*
    /System/Library/Frameworks/Python.framework/Versions/2.3/share/trac/*
    

For setting up access from Apache, see TracInstall, TracOnOsx, TracMultipleProjects.

Creating a trac environment

First choose a location for your subversion repository, e.g. /var/svn/test, and one for you trac environment, e.g. /var/trac/test.

svn repository

Specifying fs-type is actually not necessary, as we have built without bdb, thus making fsfs the default backend file system.

svnadmin create --fs-type=fsfs /var/svn/test

To make sure the repository is ok, play with it a little:

cd /tmp
mkdir proj
cd proj
mkdir trunk branches tags
cd ..
svn import proj file:///var/svn/test -m "Import First"
rm -r proj
svn co file:///var/svn/test proj
cd proj
svn update 

trac environment

trac-admin /var/trac/test initenv

You may need to manage access rights on the trac env directory tree. This may be done by first creating a unix group dedicated to this trac project, e.g. trac, and assigning the various users to this group. The apache www user should be one of these. If you need a nice description of how to do this, look at the Apple CVSOverview (then search for the text "create a new group" or "NetInfo Manager").

Your trac-admin binary may not be in your search path - if trac-admin isn't found, try:

cd /System/Library/Frameworks/Python.framework/Versions/Current/bin
sudo ln -s tracd trac-admin /usr/local/bin

to create links to them in /usr/local/bin.

To apply chgrp and chmod recursively, you may do:

cd /var/trac/test
find . -name "*" -exec chgrp trac {} \; -ls
find . -name "*" -exec chmod g+sw {} \; -ls

For further trac configuration, see TracGuide.

mario@…

OS X 10.5, basic Trac + clearsilver + bundled Apache

By Toby Thain, mailto:toby@…

Trac

Download and extract 0.10.4, then as root,

# python ./setup.py install

Note that the correct template directory (as specified in PROJECT/conf/trac.ini ) is

templates_dir = /System/Library/Frameworks/Python.framework/Versions/2.5/share/trac/templates

clearsilver

Typically, the build is problematic. I did:

# ./configure --with-python=`which python` --disable-ruby --disable-java --disable-perl --disable-apache --disable-csharp
# make
# make install

Then I had to:

# mv /System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/neo_cgi.so /Library/Python/2.5/site-packages

Apache2

Edit /etc/apache2/httpd.conf , at line 115 enable mod_fastcgi:

LoadModule fastcgi_module     libexec/apache2/mod_fastcgi.so

Hard link trac.fcgi in Apache's cgi-bin dir:

# ln /System/Library/Frameworks/Python.framework/Versions/2.5/share/trac/cgi-bin/trac.fcgi /Library/WebServer/CGI-Executables/

Create file /etc/apache2/other/trac.conf , e.g.

# Enable fastcgi for .fcgi files
<IfModule mod_fastcgi.c>
   AddHandler fastcgi-script .fcgi
   FastCgiIpcDir /var/lib/apache2/fastcgi 
</IfModule>

ScriptAlias /trac /Library/WebServer/CGI-Executables/trac.fcgi
<Location "/trac">
  SetEnv TRAC_ENV "/path/to/projectdir"
</Location>

FastCgiConfig -initial-env TRAC_ENV=/path/to/projectdir

Create the FastCgiIpcDir:

# mkdir -p /var/lib/apache2/fastcgi
# chown www:www /var/lib/apache2/fastcgi

Then

# apachectl restart

Don't forget the project directory has to be writable by user www.

Browse to http://localhost/trac/

OSX 10.5.x Leopard, SVN 1.5.x and Trac 0.11.x

By Dennis Burger

One addition to Toby Thain excellent tutorial about Trac on MacOS X Leopard. When you're updating to SVN 1.5.x you'll receive the following Trac error when opening a Trac page in you're webbrowser:

Trac detected an internal error:
SubversionException: ("Expected FS format '2'; found format '3'", 160043)

I believe this means Python's SVN bindings are not compatible with the new SVN repository layout, or it's using the old SVN 1.4 command-line client on a SVN 1.5 repository. I installed the MacOS X SVN 1.5.x binary installer (dmg) from OpenCollab.net. Check you're $PATH, or modify it so that you're also using the new SVN 1.5.x command-line client. SVN is installed in:

/opt/subversion/

The OpenCollab.net version has new Python bindings. You need to move (or copy) these 2 dirs.

/opt/subversion/lib/svn-python/libsvn
/opt/subversion/lib/svn-python/svn

… to (and overwrite the target dirs. in):

/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python

Now refresh your web browser with a Trac page to clear the cache.


See also: TracGuide, TracInstall, TracOnOsx, TracInstallPlatforms, Mac How

Last modified 9 years ago Last modified on Jan 11, 2016, 11:43:38 PM
Note: See TracWiki for help on using the wiki.