7

I'm trying to change the bundle identifier of my XCode project programmatically.

$ /usr/libexec/PlistBuddy -c "Set :CFBundleIndentifier com.myIdentifier.appName" MyApp-Info.plist

But I keep getting the error -

Set: Entry, ":CFBundleIndentifier", Does Not Exist

This is how my Info-Plist looks like and it has the entry for CFBundleIndentifier.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>CFBundleDevelopmentRegion</key>
    <string>en</string>
    <key>CFBundleDisplayName</key>
    <string>${PRODUCT_NAME}</string>
    <key>CFBundleExecutable</key>
    <string>${EXECUTABLE_NAME}</string>
    <key>CFBundleIcons</key>
    <dict>
        <key>CFBundlePrimaryIcon</key>
        <dict>
            <key>CFBundleIconFiles</key>
            <array>
                <string>Icon-120</string>
                <string>Icon.png</string>
                <string>[email protected]</string>
                <string>Icon-iPad.png</string>
                <string>[email protected]</string>
            </array>
        </dict>
    </dict>
    <key>CFBundleIcons~ipad</key>
    <dict>
        <key>CFBundlePrimaryIcon</key>
        <dict>
            <key>CFBundleIconFiles</key>
            <array>
                <string>Icon-152</string>
                <string>Icon-76</string>
                <string>Icon-120</string>
                <string>Icon.png</string>
                <string>[email protected]</string>
                <string>Icon-iPad.png</string>
                <string>[email protected]</string>
            </array>
        </dict>
    </dict>
    <key>CFBundleIdentifier</key>
    <string>com.myOldIdentifier.app</string>
    <key>CFBundleInfoDictionaryVersion</key>
    <string>6.0</string>
    <key>CFBundleName</key>
    <string>${PRODUCT_NAME}</string>
    <key>CFBundlePackageType</key>
    <string>APPL</string>
    <key>CFBundleShortVersionString</key>
    <string>3.0.12</string>
    <key>CFBundleSignature</key>
    <string>????</string>
    <key>CFBundleVersion</key>
    <string>1.0</string>
    <key>LSApplicationCategoryType</key>
    <string></string>
    <key>LSRequiresIPhoneOS</key>
    <true/>
    <key>UIAppFonts</key>
    <array>
        <string>Gotham-Bold.otf</string>
        <string>Gotham-BoldItalic.otf</string>
        <string>Gotham-Book.otf</string>
        <string>Gotham-BookItalic.otf</string>
        <string>Gotham-Light.otf</string>
        <string>Gotham-LightItalic.otf</string>
        <string>Gotham-Medium.otf</string>
        <string>Gotham-MediumItalic.otf</string>
    </array>
    <key>UIApplicationExitsOnSuspend</key>
    <false/>
    <key>UIStatusBarHidden</key>
    <true/>
    <key>UIStatusBarStyle</key>
    <string>UIStatusBarStyleBlackOpaque</string>
    <key>UISupportedInterfaceOrientations</key>
    <array>
        <string>UIInterfaceOrientationPortrait</string>
        <string>UIInterfaceOrientationPortraitUpsideDown</string>
        <string>UIInterfaceOrientationLandscapeLeft</string>
        <string>UIInterfaceOrientationLandscapeRight</string>
    </array>
    <key>UISupportedInterfaceOrientations~ipad</key>
    <array>
        <string>UIInterfaceOrientationLandscapeLeft</string>
        <string>UIInterfaceOrientationLandscapeRight</string>
    </array>
    <key>UIViewControllerBasedStatusBarAppearance</key>
    <true/>
</dict>
</plist>

Maybe I'm using the PlistBuddy wrong. How do I change the Bundle identifier of an XCode project using command line. I need to add it in a script.

2
  • I am trying to achieve the same functionality, how did you do that? In Objective C?
    – Saqib Omer
    Feb 12, 2016 at 12:43
  • @SaqibOmer he's using a script that launches a PlistBuddy command. You can add a script phase in the Build phases of your target Apr 24, 2017 at 15:54

1 Answer 1

6

You have misspelt the name of the key. It should be CFBundleIdentifier and not CFBundleIndentifier

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.