This page describes three different ways of installing Trac on Mac OS X: by hand, by using Fink, and by using pkgsrc. = Installing By Hand (Without Fink) = If you don't have Fink yet or don't want it, you can build everything yourself from the source tarballs by following the instructions in TracOnOsxNoFink. = Installing With Fink = If you already have [http://fink.sf.net/ Fink] and are comfortable using it, you may prefer to install Trac that way. But multiple people have noticed that SQLite currently won't install unless you enable [http://fink.sourceforge.net/faq/usage-fink.php?phpLang=en#unstable unstable packages] in Fink; the same goes for the handy trac-py23 package mentioned a little later on. == Updating Fink == It's probably a good idea to start by making sure your Fink base system is the most current: {{{ $ fink selfupdate }}} When it's done it'll tell you to update the rest of your packages, but I think it's ok to defer that until a little later. == Installing SQLite == You can install SQLite this way: {{{ $ fink install sqlite sqlite-dev sqlite-shlibs }}} Or, apparently, also this way: {{{ $ apt-get install sqlite sqlite-dev sqlite-shlibs }}} Though ''fink'' manages the administrator/root permissions for you, which might be handy. == Installing Subversion == Assuming you want Subversion to support secure connections, install it this way: {{{ $ fink install svn-ssl svn-client-ssl svn-ssl-swig-py23 }}} If you'd rather dispense with the SSL, get the regular versions: {{{ $ fink install svn svn-client svn-swig-py23 }}} == Updating Fink Packages == Now is I think an excellent time to have Fink update the rest of its installed packages: {{{ $ fink update-all }}} I found that the above fink commands had given me somewhat elderly Subversion 1.0.6 binaries; after updating with Fink, I got the current (at the time of this writing) 1.1.3 version. == Installing Clearsilver, pysqlite, and Trac Itself == It used to be that pysqlite and Clearsilver couldn't be installed using Fink; instructions on how to manually download and install them are below. Since then however a new Fink package has appeared which lets you install these without much fuss: {{{ $ fink install trac-py23 }}} That should be all you need to do. You can now set up your [wiki:TracEnvironment Trac environment] as per the usual instructions. If you do end up needing to install pysqlite, Clearsilver and Trac manually after having installed the rest with Fink as above, read on. == Setting up Trac using Apple Personal Webserver == To initialize a Trac environment at {{{/path/to/projectenv}}} run the following commands (you need to have a Subversion repository ready somewhere): {{{ $ trac-admin /path/to/projectenv initenv $ cd /path/to/projectenv $ sudo chown -R www . }}} '''Please remember to set approppriate permissions for your Subversion repository.''' Open the Apache configuration file {{{/etc/httpd/httpd.conf}}} for editing: {{{ $ sudo nano -w /etc/httpd/httpd.conf }}} Add the following to have Trac appear at {{{yourdomain.tld/webpath}}} (with TracPrettyUrls). Change {{{/path/to/projectenv}}} to your particular setup. {{{ Alias /trac/ /sw/share/trac/htdocs/ RewriteEngine On Options Indexes MultiViews AllowOverride None Order allow,deny Allow from all # You need this to allow users to authenticate # trac.htpasswd can be created with # cmd 'htpasswd -c trac.htpasswd' (UNIX) # do 'man htpasswd' to see all the options AuthType Basic AuthName "trac" AuthUserFile /path/to/projectenv/conf/trac.passwd Require valid-user SetEnv TRAC_ENV "/path/to/projectenv/" ScriptAliasMatch ^/webpath/(.*) /sw/share/trac/cgi-bin/trac.cgi/$1 }}} Now check if Apache is started, and possibly reload the configuration files: {{{ $ sudo apachectl start $ sudo apachectl graceful }}} Your Trac installation should now be available at yourdomain.tld/webpath/ == Manually Installing Clearsilver == Download version 0.9.12 of [http://www.clearsilver.net/ Clearsilver]. Compile it with Python support and install it in the Fink prefix. {{{ $ ./configure --prefix=/sw --with-python=/sw/bin/python2.3 --disable-ruby $ make install }}} You have to change the hard-coded /usr/local/bin/python path to /sw/bin/python2.3 (or /usr/bin/python if you're using the system Python) on the first line of scripts/document.py when running {{{make install}}}. == Manually Installing pysqlite == The file {{{setup.py}}} in the pysqlite distribution doesn't recognize the Darwin platform so you'll have to add the following lines to {{{setup.py}}} (it should be quite obvious where, but don't put it too late in the list of operating systems it checks): {{{ elif sys.platform == "darwin": include_dirs = ['/sw/include/'] library_dirs = ['/sw/lib/'] libraries = [sqlite] runtime_library_dirs = [] extra_objects = [] }}} After that modification the installation should simply be: {{{ $ /sw/bin/python2.3 ./setup.py install }}} == Manually Installing Trac Itself == You should now be all set to install Trac using the TracInstall instructions. Make sure to use {{{/sw/bin/python2.3}}} when running the {{{setup.py}}} script. Most likely, you will also need to add the path to svn-python to your path both when running trac-admin from the command line: {{{ export PYTHONPATH=/usr/local/lib/svn-python/ }}} and in your Apache configuration: {{{ SetEnv PYTHONPATH "/usr/local/lib/svn-python/" }}} An alternative to setting PYTHONPATH is to execute the following from the shell once: {{{ echo /usr/local/lib/svn-python/ > /sw/lib/python2.3/SVN.pth }}} This will cause /usr/local/lib/svn-python/ to be permanently added to the Python search path. These instructions were originally written off the top of [wiki:JonasBorgstrom Jonas Borgstrom's] head, and rearranged and rewritten quite a bit by Ryan Schmidt, and probably edited and corrected by many others. If you find errors or omissions, please edit the page and make the corrections. You can also contact Jonas. = Troubleshooting = If you have problems getting Apple's personal web sharing (a.k.a. Apache 1.3) to run trac.cgi with the correct python interpreter (/sw/bin/python2.3), you can place this dummy {{{trac.cgi}}} in {{{/Library/WebServer/CGI-Executables/}}}: {{{ #! /bin/sh /sw/bin/python2.3 /somewhere/cgi-bin/trac.cgi }}} ''This is required due to a bug in the way Python locates it's own library directory. It is present in all versions of Python up to 2.3.4, but will be fixed in both 2.4 and 2.3.5.'' -- Mark Rowe Update your python23 installation if you still need this fix. {{{ $ fink install python23 }}} or: {{{ $ fink rebuild python23 }}} = Installing using pkgsrc = As an alternative to Fink and compiling by hand, you can install from [http://www.netbsd.org/Documentation/software/packages.html pkgsrc], which runs just as well on Mac OS X as it runs on NetBSD or Linux. See TracOnNetBsd for more information. Note that at least one person couldn't get this method to work at all.