Reading Info.plist in macOS Catalina and BigSur

I have a shell script that is accessing a key value from an Info.plist like this:

/usr/bin/defaults read <PLIST_PATH> <KEY>


Despite a valid Info.plist present at the location, I am getting the following error only for macOS Catalina and BigSur:

<packageName>.pkg/Contents/Info does not exist

The same shell script runs perfectly for macOS Mojave and lower. Please help!

Posted on Jul 12, 2021 8:47 AM

Reply

Similar questions

4 replies

Jul 13, 2021 3:07 AM in response to mahika32

I have no trouble using the command you describe when provided with an existing Info.plist file.

When the path is wrong, or the key does not exist, I get "the domain/default pair of .... does not exist".

So it seems to work fine.


I am thinking that the problem may be with your script not having access to files and folders.

Where are you running the script from? Automator? A launch agent? Manually?

Jul 13, 2021 5:01 AM in response to nidhi2512

Where did you read it’s been deprecated? It doesn’t say that in the man page.


and, I to have no problem invoking the command. Make sure Terminal has folders to access. If you’re trying to execute it from within a secure shell connection, that may not be possible. You could try adding the sand to full disk access.


Deprecated or not, it’s just an XML file so you can use an XML parser to pull the key:value pair.

Jul 12, 2021 11:27 PM in response to Barney-15E

Hi Barney,

We have tried both the commands with Info.plist and Info, but both are returning the same error. We also learned that "defaults" command has been deprecated from Catalina onwards. We are looking for the alternate command which can be used instead of "defaults" to read Info.plist on all the MAC versions.


Additionally, we have checked/verified the terminal has access to "Files and Folders" access, and no full disk error.


Thanks,

Nidhi

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Reading Info.plist in macOS Catalina and BigSur

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.