Edgewall Software

Installing Trac on MacOSX using MacPorts

Installation steps

  1. sudo port install apache2
  2. sudo port install subversion +mod_dav_svn
  3. sudo port install trac

Optional:

  1. sudo port install mod_python26

Note that you must have installed the right version of mod_python for the Python version upon which Trac depends. As of September 2010 this is Python 2.6, and thus you have to use mod_python26.

After installing mod_python you may need to add LoadModule python_module modules/mod_python.so to your /opt/local/apache2/conf/httpd.conf file.

Here is the configuration for my httpd.conf:

<VirtualHost *>
  #
  # recall that ServerName has to be a read DNS name and 
  # match your VirtualHost spec (esp. if you are running on a special port)
  #
  ServerName projects.<domain>.com

  DocumentRoot "/Projects/Trac"

  #
  # don't forget to give httpd permission to read your trac docs and your trac root!
  #
  <Directory "/opt/local/share/trac/htdocs/">
    Order allow,deny
    Allow from all
  </Directory>

  <Directory "/Projects/Trac">
    Order allow,deny
    Allow from all
  </Directory>

  #
  # trac mod_python configuration
  #

  # we must first indicate where the doc supplementary 
  # files are so that trac's internal documentation works
  #
  Alias /trachtdocs/ "/opt/local/share/trac/htdocs/"
  <Location /trac>
    # then we indicate that, for this location, mod_python is in use
    SetHandler mod_python
    PythonInterpreter main_interpreter

    # next, we indicate where the "main()" is for mod_python
    PythonHandler trac.web.modpython_frontend

    # and now we configure trac via a few mod_python env variables.
    PythonOption TracUriRoot "/trac"
    PythonOption TracEnvParentDir "/Projects/Trac"
  </Location>

  #
  # trac authenticates with URLs of the form .../login, 
  # so we must match appropriately according to our TracUriRoot above
  #
  <LocationMatch /trac/[[:alnum:]]+/login>
    # for this example, only basic file-based authentication is demonstrated, 
    # but don't forget that many rich forms of authentication are available
    # including LDAP, DBM, groupfile, etc.
    AuthType Basic
    AuthName "<domain's> Trac"
    AuthUserFile "/opt/local/etc/trac-auth-file"
    Require valid-user
  </LocationMatch>
</VirtualHost>

If you installed Subversion without Berkeley DB support

If you installed Subversion with the variant +no_bdb, but the rest as above you get a Trac error:

   TracError: Unsupported version control system "svn". Check that the Python bindings for "svn" are correctly installed.

The reason is that the Subversion python bindings have been installed with the Berkeley DB support.

Either start again and follow the above instructions exactly or fix as follows:

sudo port upgrade --enforce-variants subversion-python26bindings +no_bdb
Last modified 19 months ago Last modified on Jan 11, 2016, 11:52:30 PM
Note: See TracWiki for help on using the wiki.