Edit ipa plist file in command line
Asked Answered
S

4

22

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>
Sansone answered 12/8, 2011 at 18:37 Comment(2)
Better delete this and ask the question at Ask Different before you get down votes.Made
It's more like coding, I voted up and it seems that I am not the only one :)Martinemartineau
E
34

Try this:

/usr/libexec/PlistBuddy -c "Set :items:0:metadata:bundle-identifier newidentifier" your.plist
Eyesore answered 12/8, 2011 at 20:52 Comment(1)
Command doesnt seem to work but I learnt about plist buddy, thanks heaps!Trudeau
B
5

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.

Britteny answered 12/8, 2011 at 18:57 Comment(0)
L
5

@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.

Linneman answered 30/12, 2013 at 19:0 Comment(0)
P
0

Updated version:

/usr/libexec/PlistBuddy -c "set :CFBundleIdentifier newidentifier" your.plist
Plexus answered 5/10, 2018 at 14:16 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.