Sarthak Singhal
Sarthak Singhal

Reputation: 675

Modify PRODUCT_BUNDLE_IDENTIFIER in project.pbxproj of Xcode

I'm trying to modify the project.pbxproj file of Xcode project using sed shell command on Mac Terminal to replace a string. I want to replace the field -

PRODUCT_BUNDLE_IDENTIFIER = com.example.71b9b4f2

to

PRODUCT_BUNDLE_IDENTIFIER = com.example.14a32d1e

Command used -

sed -i 's/com.example.71b94f2/com.example.14a32d1e/g' project.pbxproj

which produces the following output error-

sed: 1: "project.pbxproj": extra characters at the end of p command

I was earlier using Plistbuddy shell command to modify the field CFBUNDLEIDENTIFIER in info.plist but that doesn't change $(PRODUCT_BUNDLE_IDENTIFIER) in Xcode 7 build settings anymore.

My main aim is to modify the PRODUCT_BUNDLE_IDENTIFIER field of BUILD SETTINGS in Xcode using command line or any script.

Upvotes: 9

Views: 6610

Answers (1)

midori
midori

Reputation: 4837

OSX requires the extension to be explicitly specified. The workaround is to set an empty string:

sed -i '' 's/com.example.71b94f2/com.example.14a32d1e/g' project.pbxproj

Upvotes: 11

Related Questions