read plist through script defaults command not working

RogerH
Contributor II

I am trying to read a plist from the recovery partition on my lab machines specifically the ProductVersion Key value from com.apple.recovery.boot/SystemVersion.plist I have tried defaults read and all I get is plist does not exist. I am trying to create an extension attribute that reads that value but I am stuck without the defaults command I was thinking xmllint might work but I am having trouble with the syntax. Any and all help is appreciated!!

1 ACCEPTED SOLUTION

RogerH
Contributor II

@mm2270 Not a silly question at all yes I mounted the partition using

diskutil mount disk0s3

when I throw the command

defaults read /Volumes/Recovery HD/com.apple.recovery.boot/SystemVersion.plist

I get the response of

Domain /Volumes/Recovery HD/com.apple.recovery.boot/SystemVersion.plist does not exist

View solution in original post

5 REPLIES 5

Cornoir
Contributor II

Check the icon for your plist, I experienced a similar issue and noticed the plist I was trying to read was not properly format XML. If the icon is generic then it might be formatted incorrectly.

mm2270
Legendary Contributor III

Silly question, but is the Recovery HD partition mounted when it tries to run the defaults command? Since normally that volume isn't mounted in the filesystem, I'm wondering if when it runs the path to that plist really doesn't exist.
I assume you checked that, but I thought I'd ask just in case.

I just ran a quick test on my own Mac running Sierra and, after mounting Recovery HD, I was able to point defaults at the SystemVersion.plist and read values from it. No errors.

RogerH
Contributor II

@mm2270 Not a silly question at all yes I mounted the partition using

diskutil mount disk0s3

when I throw the command

defaults read /Volumes/Recovery HD/com.apple.recovery.boot/SystemVersion.plist

I get the response of

Domain /Volumes/Recovery HD/com.apple.recovery.boot/SystemVersion.plist does not exist

mm2270
Legendary Contributor III

We'll, that's really odd. The syntax you posted is basically identical to what I did on my 10.12.6 Mac and it worked without a hitch.

Have you tried it on a few different Macs to see if the result is any different? I'm wondering if there's something wrong or corrupted on the machine you're trying it on. I'm not clear if this is occurring across the board or not.

RogerH
Contributor II

@mm2270 I just ran it on a second machine and its seems to be working must be just that machine thanks!