5

Referring to this question where it was asked where to find ${PRODUCT_NAME} in Xcode itself, I would like to know where (so in which file) Xcode stores the value of the ${PRODUCT_NAME} on the file system?

I want to write a build script that is able to automatically access this variable and change the product name without using Xcode.

Community
  • 1
  • 1
nburk
  • 22,409
  • 18
  • 87
  • 132

2 Answers2

5

It's in MyProject.xcodeproj/project.pbxproj.

Although in this case you'll probably find you're better served by not actually changing the PRODUCT_NAME, but by changing whatever it is you're using PRODUCT_NAME for. Even then you'll probably find that the best approach is to use an .xcconfig file, which has a public format instead of the pbxproj file which has a rather arcane NextStep format.

David Berry
  • 40,941
  • 12
  • 84
  • 95
  • Agree with above re: modifying project file. If you are using `xcodebuild` in your build script and need to override PROJECT_NAME, you can also just do it on the command line. Like `xcodebuild -workspace -scheme PROJECT_NAME=`. (NOTE: at the end, not before the command). – z00b Mar 27 '14 at 22:12
  • no. productName is per target and can even default to targetName so except it is somewhere in that file, this doesnt apply. opal's answer is better – Daij-Djan Apr 03 '14 at 21:08
2

On Xcode 9.0 you can go to your main project settings > Build Settings and in the search bar find Product Name.

You will have an input field to change this value.

htafoya
  • 18,261
  • 11
  • 80
  • 104