Home > MacOS > Xcode 4, Subversion and Mac OS X Lion Server

Xcode 4, Subversion and Mac OS X Lion Server

June 23rd, 2012

We use Xcode for developing Apps and Subversion on a Mac OS X Server as source control. It was time for upgrading the SVN on the server. Before we had a Snow Leopard Server and a manually configured SVN server v1.6. The updated began to be cumbersome, so I decided to try out a more suitable way to manage subversion.

I found uberSVN and gave it a try. With some minor adjustments, it actually works fine. I describe the whole process below.

Prerequisites:

  • Mac OS X Lion Server
  • A server machine
  • A client machine
  • Time Capsule, Airport Express or an Airport Extreme
  • Xcode 4

We assume, that you use Subversion for more than just a local source control, hence the requirement of a Time Capsule or Airport.

Installing the Server

  1. Download and install uberSVN It might be necessary to install Java 6, if you do not have that installed yet. You can get it from the Apple. Start Software Update, select from the menu: Update -> Go to Apple Download Page. Then search for Java and fetch the latest greatest.
  2. Important is to use your public static IP address and not the local network IP, ie. NOT 127.0.0.1 nor 192.168.xxx.yyy.
  3. When the uberSVN tries to restart it will not be able to reach the web console. This is because we have not configured port forwarding and other items on security yet. Replace the browser address with 127.0.0.1 for now, then you should get into the web administration of uberSVN.
  4. Create at least one user for SVN from the admin web page. For reference, let’s call him svnUser. You might also want to create a team, but it is not required.
  5. Create a repository. For reference, let’s call this myRepository.

Now the most important thing…

Security on Server Side

  1. Start the Airport Utility, select your base station and Edit. Go to Networking. Here you see the port settings. These are the port forwardings, allowing internet connections to reach your server.
  2. Add a port forwarding for your repository access. The default uberSVN port (non secure) is something like 98xx. You can choose what suits you best, but I recommend to stick close to the default. Let’s assume you pick 9800. Enter this port for public TCP port and private TCP port. The private IP address must be the address of your server on the local network. You must make a DHCP reservation for your server, when you use DHCP on your network. Otherwise your server might get a new IP address each time it reboots and then all this port forwarding will fail.
  3. You might want to port forward another port for administrating uberSVN on your server. This is not required, but it is convenient. Let’s assume you do so and you pick port 9801.
  4. Update your base station to save the changes. You might want to check and extra time, that your forwardings are still as specified. The airport will clear the port forwarding fields, if you entered a port, which in some way is not valid. It might be in use or reserved.
  5. Back on the server, you have to tell your firewall to pass the ports through as well. Start Server Admin and select the Firewall. Then select Settings to the upper right. Now select Services.
  6. Add the port(s) you have added on the base station by pressing ‘+’. The name does not matter per se, but you should name it for what you use it for.
  7. Save the new settings by pressing save.
  8. Back in the uberSVN, select Administration and then select Subversion Server. Enter the port you have chosen for your repository (eg. 9800) and check the “use https” option.
  9. Restart uberSVN by pressing the button to the upper right.
  10. Go to the uberSVN server tab, if you want an external administration access as well. Enable here HTTPS and enter the admin port (eg. 9801).
  11. Restart the uberSVN server again.
  12. Now, you can try to access the server from your client. The easiest way to check is to write svn co https://<IP>:9800/myRepository
  13. Your Mac will most definitely prompt you with a certification problem. It is very important that you type “p” for permanent here. This is one of the magic pieces, that eases your pain with Xcode and SVN.
  14. Check your port forwardings and server firewall settings, if you cannot connect.

This concludes the security. Onto Xcode…

Xcode

Quit Xcode, if it is running and check out this page for setting up SVN v1.7 for Xcode. It will not work otherwise!

  1. Start Xcode and open a sample project for test
  2. Open the Organizer and add a new repository
  3. Use the connection string as before: https://<IP>:9800/myRepository
  4. Then you have to enter username and password. Use the ones you have added to uberSVN. Note, that Xcode might not close the dialog, but you have to cancel it. This is not a problem, as you will get through anyway. There might be a little problem if it takes you too long to enter the password, because you have only a limited time to enter your credentials.
  5. For trunk, branches and tags – just use these names.
  6. Now, import the project
  7. Wait…
  8. Wait…
  9. And wait some more… I have no clue, why there is no progress bar for this.
  10. Finally you can see the project as a folder in subversion
  11. Remove the local copy of the project and checkout the project via Xcode. This is necessary because otherwise the SVN information will not be available for the project.
  12. After some waiting you are given the option to open the project in Xcode.

That’s it! Please comment on this post, if there are some mistakes or something is missing. The SVN integration is the not the greatest in Xcode and you might see some other issues, which I did not get. Good luck and hopefully this helps you along.

Categories: MacOS Tags: , , , ,
Comments are closed.