I neet to add following lines into Info.plist file via Terminal:
<key>SBAppTags</key>
<array>
<string>hidden</string>
</array>
Please tell what I should write in command line to get the lines above?
I tried something like that:
but with no luck...
You should take the XML format you'd like to use and put it in the command but after removing the "Key" out of it ,as it has been entered after the "-insert" option, along with any whitespace.
Here's how an array entered:
plutil -insert SBAppTags -xml "<array><string> hidden </string></array>" Info.plist
Here's how a dictionary entered:
plutil -insert SBAppTags -xml "<dict><key>myFirstKey</key><string>hidden</string></dict>" Info.plist
On macOS Monterey, you can do this in a more straightforward way with a few steps:
#!/bin/zsh
plutil -create xml1 Info.plist # create an empty file [optional]
# insert an empty array
plutil -insert SBAppTags -array Info.plist
# append a string to the array
plutil -insert SBAppTags -string hidden -append Info.plist
The result is:
<?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>SBAppTags</key>
<array>
<string>hidden</string>
</array>
</dict>
</plist>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With