If you use version control (and you should), then you’re familiar with the pollution that an Xcode build folder can put into your status output:
? build/.DS_Store ? build/Debug/UTI Plist Helper.app/Contents/Info.plist ? build/Debug/UTI Plist Helper.app/Contents/MacOS/UTI Plist Helper ? build/Debug/UTI Plist Helper.app/Contents/PkgInfo ? build/Debug/UTI Plist Helper.app/Contents/Resources/English.lproj/InfoPlist.strings ? build/Debug/UTI Plist Helper.app/Contents/Resources/English.lproj/MainMenu.nib/classes.nib ? build/Debug/UTI Plist Helper.app/Contents/Resources/English.lproj/MainMenu.nib/info.nib ? build/Debug/UTI Plist Helper.app/Contents/Resources/English.lproj/MainMenu.nib/keyedobjects.nib ⋮
Good version-control systems offer a way to ignore any file that matches a certain pattern. In the case of an Xcode project, you want to ignore the build folder and a few other things: .DS_Store files, backup nibs (those Foo~.nib packages that IB creates when you save), etc.
In order to save you repetitive work, here’s a .hgignore file, already fully-populated, that you can use when versioning your Xcode-based project with Mercurial:
What to do with this file
- Download it, and save the .bz2 file somewhere such as your Documents folder.
- cd into the top level of a repository.
- Extract the file using this command line: bunzip2 < ~/Documents/hgignore.bz2 > .hgignore
- Add the file: hg add .hgignore
- Commit it.
Thereafter, not only do you have a .hgignore file keeping your status output clean, but it’s versioned, so it’s easy for you to track and revert changes to the ignore file over time.
UPDATE 2011-05-05: Updated for Xcode 4.