Library to read/write pbxproj/xcodeproj files? [closed] Library to read/write pbxproj/xcodeproj files? [closed] xcode xcode

Library to read/write pbxproj/xcodeproj files? [closed]


The surface syntax of an Xcode project is an "old-style plist." You can easily convert it to an XML plist with the command

plutil -convert xml1 -o - myproj.xcodeproj/project.pbxproj

Note this is not "real XML" but the Mac OS X plist structure expressed in XML syntax; it consists almost entirely of key-value pair dictionaries and arrays. Xcode will read the XML representation but convert it back to "old-style plist" when the project is opened.

The structure and relationship of the items in the plist follow the structure of the project. The UUIDs are used to cross-reference items between the project and its targets, and between the project and the user files in the project wrapper.

The 'isa' key identifies each kind of object. The PBXProject contains PBXFileReference, PBXGroup, PBXNativeTarget, and PBXBuildConfiguration objects.

The targets have PBXBuildPhase objects that contain cross-references to the file references; BuildConfigurationLists that store the build settings for the targets, and other target settings like the target type and name.

The buildConfigurationLists cross-reference buildConfigurations, which in turn contain dictionaries of buildSettings.

I'd recommend looking at the old-style plist text first, as it's much more readable and actually has inline comments to tell you what's what. Then you can use XML tools to edit or write the project files to your liking.


I ended up creating one, and it's hosted on github here:

https://github.com/jasperblues/XcodeEditor

Allows listing headers, files, adding source files, setting source file as a member of a target, adding images, creating groups, etc).

It works by manipulating the contents of the project.pbxproj file. Used in:

  • Less Painful: Automated functional testing for mobile applications. (Edit: now part of Xamarin's tools).
  • Level Helper: A RAD framework for developing 2D games on iOS & Android.
  • TextMate
  • Apportable


I just discovered this: https://github.com/alunny/node-xcode I haven't used it yet, but it looks promising for Node.js developers.