Install and run SVN on OS X

Dec 18, 2005

SVN useage and installation notes for OS X (only tested with Tiger). You may need to have Developer Tools installed, or may prefer the convienience of DarwinPorts or Fink. Download and install, Subversion svnX (if you’d like a GUI). 1. Once subversion is installed open a terminal and navigate to a directory in which you’d like to create a repository. cd ~/Documents/Repositories/ 1b. Export the path to subversion for your shell. I’ve got subversion installed in /usr/local/bin and in ~/.profile have the line export PATH="$PATH:/usr/local/bin" 2. Run svnadmin to create a new repository. svnadmin create helvector 3. Open svnX, choose window > Repositories. In the window click + to add a new repository, Name name it and then enter its file path, eg file://Users/simon/Documents/Repositories 4. Double click the repository in the list, this will launch the repository in it’s own window. You can now drag and drop existing files to the “root” in the lower half of the screen. 5. Now it’s time to create a working copy. There’s two buttons in the window bar checkout and export. Export will allow you to export a version to a file path creating a copy of the repository which no longer has any association to it. Checkout does the same but keeps the files associated with the repository so you can then work with them - commiting, updating etc. You’ll need to explore yourself from here. 6. Setting up svnserve. Open the terminal and type svnserve -d (you need to open the port 3690 on the firewall ) your repositories should now be available on the network via: svn://xxx.xxx.xxx.xxx/path/from/root/to/the/repository 7. You’ll likely want to have the svnserve daemon launch automatically when a request comes in from the network. According to the subversion book you need to alter /etc/inetd.conf but things have changed in 10.4 and you’ll find that the file is commented out and points you towards the command line app launchd which is explained here. 8. From this thread I followed the instructions and created a plist file with the following contents (you may need to change the path to your svnserve install).```

<?xml version\="1.0" encoding\="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd"\>
<plist version\="1.0"\>
    <dict\>
        <key\>Label</key\>
        <string\>svn</string\>
        <key\>Program</key\>
        <string\>/usr/local/bin/svnserve</string\>
        <key\>ProgramArguments</key\>
        <array\>
            <string\>/usr/local/bin/svnserve</string\>
            <string\>\--inetd</string\>
        </array\>
        <key\>SessionCreate</key\>
        <true/>
        <key\>Sockets</key\>
    </dict\>
    <dict\>
        <key\>Listeners</key\>
    </dict\>
    <dict\>
        <key\>SockServiceName</key\>
        <string\>svn</string\>
    </dict\>
    <key\>StandardErrorPath</key\>
    <string\>/dev/null</string\>
    <key\>inetdCompatibility</key\>
    <dict\>
        <key\>Wait</key\>
        <false/>
    </dict\>
</plist\>

Download: Then place the file in ~/Library/LaunchDaemons/org.tigris.subversion.plist there’s two ways of kicking into action. Log out and back in. Or use launchctl load ~/Library/LaunchDaemons/org.tigris.subversion.plist then to turn it off launchctl unload ~/Library/LaunchDaemons/org.tigris.subversion.plist Which is useful when debugging.


Comments:

Adam - Oct 0, 2007

I found the sample plist to be invalid. It gave me errors when I tried to launch it using launchctl. I was able to get it up and going by following the apple devloper example and removing several closing tags and setting values to keys. For instance the line under the Sockets needs to be removed so that the list with listners is set to the value of the key.