Is it possible to export xcode build settings to .xcconfig file? Other than just copy-paste it to text file line-by-line. Thanks!
-
8Here's a script written by former Apple engineer James Dempsey that automates the process of extracting the data and generating the files: http://jamesdempsey.net/2015/01/31/generating-xcode-build-configuration-files-with-buildsettingextractor-xcodeproj-to-xcconfig/. If the above link should become invalid you can also try downloading the script source directly from github: https://github.com/dempseyatgithub/BuildSettingExtractor – xdeleon Nov 15 '15 at 21:44
-
@xdeleon Thanks for sharing. The script works GREAT. What I really liked was that it also extracts what's common between your debug and release settings for a given target. It places what's common in `
-shared.xcconfig` and then it gets imported/included in your debug/release configs using `#include – mfaani Jun 14 '21 at 20:04`
2 Answers
This SO answer helped me.
Show the package contents of your project file (MyProject.xcodeproj) by two-finger clicking (right-clicking) on it in finder, then open the 'project.pbxproj' file in a text editor.
Look for the section XCConfigurationList. It starts with /* Begin XCConfigurationList section */
. You will find all your targets and their respective builConfigurations. Now do a find (command - f) on the long hex ID to find the other occurance in the project.pbxproj where you should also find your buildSettings. Copy and paste everything between the buildSettings brackets into your xcconfig file. You will then need to massage some of the variables, specifically the lists of search paths.
Alternatively, you can use xcodebuild from the command line:
First to list your schemes and configurations:
xcodebuild -list
Then export your desired scheme's settings:
xcodebuild -scheme "schemeName" -showBuildSettings >> mynew.xcconfig
or as others said, to export a certain configuration within a scheme, do:
xcodebuild -scheme "schemeName" -configuration "Debug" -showBuildSettings >> mynew.xcconfig
You will then need to delete the first line or comment it out

- 33,165
- 3
- 43
- 43

- 2,495
- 26
- 22
-
4This `xcodebuild` command uses the default configuration. If you want to, let's say, show just the config settings for the `Debug` configuration, the command would be: `xcodebuild -scheme "schemeName" -configuration "Debug" -showBuildSettings >> mynew.xcconfig` – Steven Peterson Feb 09 '19 at 02:09
You don't have to copy-and-paste line-by-line. You can select all and copy all lines at once. The only restriction is you can't copy lines with <multiple values>
as a value. That is, if you've got one setting that has specifies a different value for both Debug
and Release
, etc. you need to deselect just that line (cmd-click) to copy.

- 18,605
- 8
- 55
- 84
-
How do you get the xcconfig to manage both Debug and Release versions then? Thx. – Hari Honor Nov 23 '20 at 12:13
-
1You would have just copied those lines individually. But note this answer was written in 2012. I don't think any of these limitations still exist in modern Xcode versions. – jemmons Nov 24 '20 at 18:39