Xcode 4, Subversion and Mac OS X Lion Server
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.
- 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
- 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.
- 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.
- 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.
- 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.
- Create a repository. For reference, let’s call this myRepository.
Now the most important thing…
Security on Server Side
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- Save the new settings by pressing save.
- 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.
- Restart uberSVN by pressing the button to the upper right.
- 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).
- Restart the uberSVN server again.
- 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
- 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.
- Check your port forwardings and server firewall settings, if you cannot connect.
This concludes the security. Onto 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!
- Start Xcode and open a sample project for test
- Open the Organizer and add a new repository
- Use the connection string as before: https://<IP>:9800/myRepository
- 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.
- For trunk, branches and tags – just use these names.
- Now, import the project
- And wait some more… I have no clue, why there is no progress bar for this.
- Finally you can see the project as a folder in subversion
- 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.
- 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.