xcconfig for DEVELOPMENT_TEAM

2022-01-19 ยท 2 min read

To build and test a Swift app on your macOS, you need to sign in to an account with macOS Developer Program enrolled. That process turns into a configuration field known as DEVELOPMENT_TEAM in your project file. So oftentimes, if you git clone a project from other people, you have to change its DEVELOPMENT_TEAM before building and testing locally.

But that change would create more problems if every participant used a different DEVELOPMENT_TEAM setting. That is common when working with open source projects. In the initial release of CodeLauncher source code, DEVEOPMENT_TEAM is also included in the project file. So we wanted to find a way to simplify this so that every participant will not need to waste time changing these trivial things.

So the method we find is to use xcconfig files. The project can include a default file for all the default values:

DEVELOPMENT_TEAM = 3SCMMGZXY8
ORGANIZATION_IDENTIFIER_PREFIX = com.v2ex
CODE_SIGN_IDENTITY = "Developer ID Application"
CODE_SIGN_STYLE = Manual

#include? "local.xcconfig"

Then the last line optionally includes another xcconfig file which git ignores. So personal settings can be put in that local.xcconfig file. Since git ignores it, it will not touch the default values for the project.

We find that method simple. All you need to do is put your own DEVELOPMENT_TEAM and ORGANIZATION_IDENTIFIER_PREFIX in a local.xcconfig file.

If Xcode is still complaining about the DEVELOPMENT_TEAM setting, it is probably due to DEVELOPMENT_TEAM being set in the project file. So you will need to make sure that DEVELOPMENT_TEAM is not in the project.pbxproj file.