Using Subversion with Xcode, Part II

In my previous post, Using Subversion with Xcode, Part I, I covered how to create a repository and provided a set of scripts to use to automate these tasks. In this post I will demonstrate how to use the SCM client within Xcode to access your Subversion server.


Before you can use Xcode’s SCM client to connect to your Subversion server, you need to enable the SSH server on your Mac. SSH server is installed by default on OS X 10.5, to enable it open System Preferences.

From the Internet & Network section, select the Sharing icon, within the Sharing preferences check the box labeled Remote Login.


That’s it, at this point your SSH server is running.

Configuring SCM Repositories

After you launch Xcode, you can configure your SCM repositories by selecting SCM > Configure SCM Repositories… from the menu bar, this will open the Xcode SCM Preferences window.

Click the the plus sign ‘+’ to create your repository, it will prompt you for a name and ask you to select which SCM System you are using (Subversion in our case).

Repo Name

Now you need to build the URL to connect to the repository on your computer. Here you enter the Scheme, Host, Path, User and Password and have Xcode build the URL for you.

Scheme: svn+ssh

Host: either <computer name>.local or localhost

Path: the absolute path to your repository

Port: N/A

User: your login username

Password: your login password

Repo Configuration

If you entered everything correctly, you should see a green light indicator with the word Authenticated beneath the password box, click OK. If you are encountering errors, double-check that all information is entered correctly above. You can also try connecting to yourself through SSH via the Terminal: ssh username@localhost.

Configuring Projects

Before you import your projects in to Subversion, you may want to configure your project so that your build files are not located in the same directory as your project. It is normally not necessary to place these files under version control, as they can easy be regenerated by rebuilding your project.

Project Settings

Viewing SCM Repositories

Whenever you are ready to import into Subversion, you can add it through the Xcode SCM client by selecting SCM > Repositories from the menu bar, this will open the SCM client. If you ran my scripts from the previous post, you should see the following in each column:

Column 1: All of your configured Repositories.

Column 2: The Projects folder you specified when setting up your repository

Column 3: The Project you created

Column 4: The Subversion folders that were automatically created with the script

The horizontal window at the bottom will display the Subversion commands that are being run when you select an item from each column. This can be helpful troubleshooting tool if you are having access or permission problems.


Importing Projects

To add your project to Subversion, click the Trunk folder and then click the Import icon. This will display the directory import dialog, here you will want to select the folder of your local project and enter a meaningful comment.

Project Import

Configuring Projects for SCM

Now that you’ve added your project to Subversion, you will want to configure it so you can start versioning any changes to your code. You may want to create a separate directory on your computer to store projects that are under version control. I recommend choosing a location that is separate from the directory where you initially imported from. Once you establish a location, select the Project folder under the Trunk folder and click the Checkout icon, here is where you will select the folder you created. After you click Checkout, you should receive a Checkout Complete dialog window where you are given the option to open the project. Congratulations! At this point your code should be under version control.

Part III will show you how to commit any changes that you make and will explore some of the SCM tools.

Tagged with: , , , , ,
Posted in Tools
2 comments on “Using Subversion with Xcode, Part II
  1. Dustin Senos says:

    Regarding the build location:

    It might be best to use the svn:ignore property to ignore the build directory rather than moving it outside your project folder. The settings listed above will only work on your local machine as your computer name is hard-coded into the value. By taking advantage of svn:ignore you’re able to build to the original location but ignore any files within that directory. This will allow your projects to be easily built on different machines without having to change settings.


  2. Nitin Gaikwad says:

    I am not able to see the SCM tab in xCode i have check in xcode 4.3.2 and xcode 5 also can please tell how that menu tab will be able to see?

2 Pings/Trackbacks for "Using Subversion with Xcode, Part II"
  1. […] « Boredom vs. Being Unmotivated Using Subversion with Xcode, Part II […]

  2. […] Using Subversion with Xcode, Part II […]

Leave a Reply