Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Edit ipa plist file in command line

Tags:

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> 
like image 823
kevmalek Avatar asked Aug 12 '11 18:08

kevmalek


People also ask

How do I edit my Apple plist?

plist file. If you need to edit these items, Control-click (or right-click) Info. plist in the sidebar and select Edit Manually. This allows you to add or edit items in raw XML format.

How do you edit a plist on a Mac?

Open it and inside, there should be at least one Plist file called info. plist. Right-click it and select Open With>Xcode. The file will open in Xcode and you can edit the already existing rows of preferences.

How do you unlock plist files on a Mac?

Using The FinderSelect the plist file in the Finder and doing File > Get Info. At the bottom of the file info window you'll see a section called Sharing & Permissions. You want to make sure you're in that list and that you have Read & Write level access to the file.


2 Answers

Try this:

/usr/libexec/PlistBuddy -c "Set :items:0:metadata:bundle-identifier newidentifier" your.plist 
like image 191
user478681 Avatar answered Sep 30 '22 18:09

user478681


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.

like image 32
sorpigal Avatar answered Sep 30 '22 19:09

sorpigal