Question

I'd like to change the 'bundle-identifier' string value in a plist file using the command line. Using 'defaults', how would I do this?

FYI here is the plist in its entirety:

<?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>items</key>
   <array>
   <dict>
       <key>assets</key>
       <array>
           <dict>
               <key>kind</key>
               <string>software-package</string>
               <key>url</key>
               <string>http://eventpilotadmin.com/doc/clients/ISES/Eventworld2011/proofs/iphone_Eventworld2011_proof.ipa</string>
           </dict>
       </array>
       <key>metadata</key>
       <dict>
           <key>bundle-identifier</key>
           <string>com.ativsoftware.Eventworld2011</string>
           <key>bundle-version</key>
           <string>1.0</string>
           <key>kind</key>
           <string>software</string>
           <key>title</key>
           <string>Eventworld2011</string>
       </dict>
      </dict>
   </array>
</dict>
</plist>
Was it helpful?

Solution

Try this:

/usr/libexec/PlistBuddy -c "Set :items:0:metadata:bundle-identifier newidentifier" your.plist

OTHER TIPS

If the line format is consistent you could do it with sed like this:

sed -n '/bundle-identifier/{p;n;s/>.*</>new value</;};p' your.plist

In your example this would change com.ativsoftware.Eventworld2011 to new value

Add -i to edit in place.

@user478681's answer did not work for me, because of the missing step to unzip and zip the ipa file.

I found a site with those steps.

In short:

unzip app.ipa
/usr/libexec/PlistBuddy -c "Set :CFBundleIdentifier newidentifier" Payload/MyApp.app/Info.plist
zip -qr ResignedApp.ipa Payload

If you need to resign your app, follow the instructions on the aforementioned site.

Updated version:

/usr/libexec/PlistBuddy -c "set :CFBundleIdentifier newidentifier" your.plist
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top