Mac Subversion Server Guide - SVN Server Downloads and Tutorials
Mac Subversion Server Guide - SVN Server Downloads and Tutorials
http://svn-ref.assembla.com/subversion-server-guide-mac-os.html
Home
Server Guide
Client Guide
Resources
Download Clients
Share
If you're using Mac OS X 10.4.5 or better and you used the Collabnet Installer above, you'll need to first tell your system which Subversion
installation to use, since it already has version 1.4.4 installed. To do this, you'll need to prepend the PATH environment variable with the new
subversion install location. To do this, open a Terminal Window (located in the Applications/Utilities Folder) and type everything you see after the
dollar sign, then hit return:
$ pico ~/.bash_profile
export PATH=/opt/subversion/bin/:$PATH
Then hit Control + X, then confirm saving the file with 'y', then hitting return. Now we've added the new Subversion installation to your System's
path and need to tell the Terminal that we've updated this variable. To do that type the following and hit return: (note: there is a space between
the first and second periods)
$ . .bash_profile
Now, when we type the following we should see that we are running Subversion v1.6.6
1 of 4
2/5/15, 10:10 AM
http://svn-ref.assembla.com/subversion-server-guide-mac-os.html
$ svn --version
Share
$ mkdir -p /Library/Subversion/Repository
You can put them anywhere you like, we just chose this as a suitable default location.
Now we'll use the Subversion administration tool, svnadmin, to create our first repository. For this Tutorial, we'll call our first project aptly titled
"myfirstproject:"
$ cd /Library/Subversion/Repository
$ svnadmin create myfirstproject
Great! Now that we've created our first repository, we need to configure the permissions for who can access the repository. To do that we'll need
to edit the configuration file "svnserve.conf" located in your project's "conf" directory. Open "/Library/Subversion/Repository/myfirstproject
/conf/svnserve.conf" in your favorite text editor.
When you open this file, you'll see a heavily ### commented file. The lines with the single "#" comment marks are the ones we need to edit. You'll
want to remove the comments (#) and customize these settings to suit your project's needs. Here are what the main directives in this file mean:
password-db - this is the name of a text file that stores the usernames and passwords of authorized users for your repository. Unless otherwise specified, it will
be assumed that this file is stored in your projects "conf" directory. When you create your repository a "passwd" file is created by default. You may want to
change this to something a little more cryptic. If you would like to set up a single password file that would work with multiple repositories, you may wish to store
this password file elsewhere, and use an absolue path such as /Library/Subversion/Users/passwd-db
realm - realm tells clients what they are connecting to. It's recommended you customize this to something like "<Project Name> Subversion Repository." But
you can of course choose any name you wish.
anon-access - this directive indicates what anonymous users are allowed to do with your repository. The three valid values are none, read, and write. As you
would expect, none allows anonymous users to neither read nor write to your repository; read grants read-only access, and write (not recommended) allows for
both read and write permissions.
auth-access - determines what permission level authorized users will have. In almost every case this will be set to write. Again, the three valid options are
none, read, and write.
At the bottom of this conf file, you may also see the option to use SASL to handle security and authorization for your Server. We're going to leave
that commented out, but if you want to explore a more secure alternative, you can find out more about configuring Subversion Server to work with
SASL in the SVN Book, which is available from the Collabnet folder from your Start Menu or on the SVN Book website here: Using svnserve with
SASL.
Once you've saved your customized svnserve.conf, you'll need to open or create your password-db file. In this example we've just used the
included passwd file located in the conf directory. Open that file, and you'll see something like the following:
[users]
# harry = harryssecret
# sally = sallyssecret
Using the same format, you can add as many users to your repository(s) as you want in this file. Add at least one user for yourself so that you
can begin committing to your repository, and save the file.
Next we'll need to change the permissions on the Repository directory so that svnserve is permitted to make changes to the files stored there:
After you've done that, it's time to fire up the svnserve Subversion Server daemon:
$ svnserve -d -r /Library/Subversion/Repository
2 of 4
2/5/15, 10:10 AM
http://svn-ref.assembla.com/subversion-server-guide-mac-os.html
Share
Let's create a directory called projects in our home directory to hold the working copies of our SVN Projects, and then issue the commands to
check out a working copy of the project we created in the previous step:
$ cd ~
$ mkdir projects
$ cd projects
$ svn checkout svn://localhost/myfirstproject
If you set read permissions to authorized users only, you'll be prompted to enter your username and password. After you've successfully checked
out a working copy, we'll add a default project layout and a test file before we make our first commit.
$ cd myfirstproject
$ svn mkdir branches tags trunk
$ touch trunk/test.txt
$ svn add trunk/test.txt
Because we're inside of the my project directory we don't need specify the url to the repository. If you have specified in your svnserve.conf file
that only authorized users can make commits, then you'll be prompted again for your username and password.
If your commit was successful, you should see some output like this:
Adding branches
Adding tags
Adding trunk
Adding trunk/test.txt
Committed revision 1.
Now you've successfully installed, configured, and worked with your first project hosted on your own Subversion Server.
4. Additional Resources
Make svnserve launch on startup
It wouldn't be very practical to have to remember to manually start svnserve each time your server needs a reboot. To fix this issue, read this
tutorial to learn how to create a daemon that launches automatically whenever the server boots using launchd.
Manually Integrate Subversion with Apache
If you chose not to install Apache along with Subversion, we realize that doesn't mean you don't want to use it. If you need to integrate your new
Subversion server with a pre-existing 2.2.x Apache Server, this guide is for you.
Free Mac OS Subversion Client Guide
Need a Graphical Subversion Client for your Mac development machine? We've reviewed some of the most popular mac client's in our
Subversion Client Guide.
The Subversion Book
"Version control with Subversion" published by O'Reilly, is the go-to manual for all things subversion, and you can view it online or as a pdf. (If
you used any of the installers above, you'll find the manual available from your start menu as a pdf or chm). If you have more advanced
3 of 4
2/5/15, 10:10 AM
http://svn-ref.assembla.com/subversion-server-guide-mac-os.html
configuration needs, or just want to get more familiar with Subversion... RTFM! :-)
Official Subversion Website
Join the subversion project, checkout the latest nightly build from source, file a bug report, or just learn more about the project here.
Share
Company
Products
Resources
Support
About Assembla
Workspaces
Developer API
Testimonials
Enterprise
Feature Requests
Google+
Blog
Blog RSS
Connect
Contact Us
4 of 4
2/5/15, 10:10 AM