Xcode 3 Template Location Clarification
In a previous post on Xcode 3′s new locations for project and file templates, I said project and file templates needed to be in the following locations:
Xcode 3 Addition: Python and Ruby Cocoa Project Templates
Xcode 3 includes project templates for writing Cocoa applications in Python and Ruby. Those of you who were turned off of Cocoa by Objective C’s syntax can now give Cocoa development a try.
If you installed the developer examples when you installed Xcode 3, you will find on your hard drive many examples of Cocoa programs written in Python and Ruby. You can find the Python examples at the following location:
You can find the Ruby examples at the following location:
Interface Builder 3 Change: No Subclass Creation
Older versions of Interface Builder let you create subclasses for Cocoa applications and generate source code files for the subclasses you created. As an example, you could drag an OpenGL view to a window, subclass the OpenGL view, and have Interface Builder create .h and .m files for the subclass. But Interface Builder 3 no longer lets you create subclasses. How do you create the subclasses?
Xcode 3 Change: Run Log
Older versions of Xcode had a run log window that let you view the output of command-line programs. Where did it go in Xcode 3?
Xcode 3 Change: Universal Binaries
The Release build configuration for Xcode 3 is set to create 32-bit universal binaries for Cocoa and Carbon application projects. All you have to do is create a Cocoa or Carbon application project, and you’re set to build a universal binary. You’ll have to modify the Architectures build setting if you want to build a 64-bit version of your application.
Xcode 3 Change: Release is the Default Build Configuration
In Xcode 3 Apple changed the default build configuration from Debug to Release. This decision does not make much sense. Unless you’re writing a simple program, you’re going to want to debug your program when you start writing it. Wanting to debug your program means that you want the Debug build configuration, not the Release configuration.
Xcode 3 Feature: Version Control Repository Access
Xcode 3 adds support for configuring and viewing version control repositories. With Xcode 3 you can import projects and checkout files inside Xcode. All you have to do from the command line is create the repository. This article will show you how to take advantage of Xcode 3′s enhanced version control capabilities. One word of caution. If you hated Xcode’s version control support in earlier versions of Xcode, you’ll want to stick with the command line. Xcode 3 repository features are a little flaky.
Xcode supports Subversion, Perforce, and CVS. I’m going to focus on Subversion because Mac OS X 10.5 ships with Subversion, and CVS seems to be losing popularity with developers.
If you haven’t done so already, open the Terminal application and create a repository by running the svnadmin create command. I have detailed instructions you can read (PDF) on creating a repository if you need them. One thing to note is that because Mac OS X 10.5 ships with Subversion, you don’t have to install it, and in Mac OS X 10.5 Subversion is in /usr/bin instead of /usr/local/bin.
Before you can take advantage of Xcode’s repository features, you must configure your repository in Xcode. Launch Xcode and choose SCM > Configure SCM Repositories. A window similar to the following figure will open:
Click the + button to add a repository. You will be asked to name the repository and specify what version control system you’re using.
Now you must specify the URL for the repostiory. A local repository’s URL starts with file:// and follows with the path to the repository on your hard drive. If the path you specify does not show up in the Path field, you’ll have to enter the path to your repository in the Path field.
Click the OK button, and you’ve configured the repository.
Choose SCM > Repositories to open Xcode’s repositories window, which you can see in the figure below. The repositories window lets you examine the directories inside your version control repositories. Select a repository from the list on the left to examine that repository’s directories. Some things you can do from the repositories window is import projects, check files out of the repository, create directories, move directories, and delete directories.
If you’ve created a fresh repository, I strongly recommend creating a directory inside the repository and storing your projects inside that directory. In my experience using Xcode’s repository features on a fresh repository, I noticed Xcode let me add only one directory to the root of the repository. Any additional directories I tried to create were created inside the first directory I created. This is why I recommend creating a directory, naming it something like Projects, and import your individual Xcode projects into the Projects directory.
If you have a repository that you’ve been using for some time, you’ll see directories inside the repository root for the projects you have in your repository. If you try to add or import a directory to the repository root, the directory will get added to one of the subdirectories inside the root. There are two solutions.
First, you can fire up Terminal and create a directory from the command line using the svn mkdir command. I had difficulty getting my created directory to appear in the repositories window, but after a few attempts I did get the directory to appear. Second, you can create a fresh repository for your new projects, add a Projects directory to the new repository, and use the new repository for any new projects you want to place under version control.
Before importing a project, you must create an Xcode project and move the project’s files to a folder. If you follow Subversion conventions, you’ll go to your project folder in the Finder and add three folders named branches, tags, and trunk. Move your project files to the trunk folder.
To import a project, select the directory in the repositories window where you want to import the project (If you’re following along, this will be the Projects directory you created in Xcode’s repositories window) and click the Import button. An Open File dialog opens. Navigate to your project folder, type a comment, and click the Import button.
There should be a directory inside the Projects directory with the name of your project. Inside the project name directory should be the branches, tags, and trunk folders. The trunk folder should contain your project’s files. If these folders don’t show up, click the Reload button to refresh the repositories window.
After importing a project, you want to check out the source code files in your project. Select your trunk folder in the repositories window and click the Checkout button. A dialog box opens asking you where you want to store the checked out files on your hard drive. Navigate to where you want to store the checked out files. Normally you will store the checked out files in a folder inside your Xcode project’s folder. Click the Checkout button. You’ll be asked if you want to open the Xcode project. Open it if you want.
Although you’ve imported a project and checked out files, you still have to tell Xcode to use version control for the project you imported. Open the Xcode project (the project file you checked out in Step 5, not the original one you created in Xcode). Select the name of the project from the Groups and Files list and click the Info button on the project window toolbar. An information panel will open. Click the General button in the information panel. Choose your repository from the SCM Repository pop-up menu, and you’re ready to use version control with Xcode in Mac OS X 10.5.
Xcode 3 Change: New Template Locations
If you create your own Xcode project and file templates, you should know that Apple changed the location for templates in Xcode 3. For your project templates to show up in Xcode’s list when you create a new project, make sure your templates are in the following location:
Xcode 3 Change: No ZeroLink
Apple removed ZeroLink in Xcode 3, which makes my ZeroLink post obsolete for those of you using Xcode 3. Apple says it improved the speed of the linker in Xcode 3 so ZeroLink is no longer needed.



