Skip to main content
Solved

read plist through script defaults command not working


Forum|alt.badge.img+15

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!!

Best answer by RogerH

@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 original
Did this topic help you find an answer to your question?

5 replies

Forum|alt.badge.img+7
  • Contributor
  • 98 replies
  • July 31, 2018

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
Forum|alt.badge.img+16
  • Legendary Contributor
  • 7880 replies
  • August 1, 2018

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.


Forum|alt.badge.img+15
  • Author
  • Contributor
  • 92 replies
  • Answer
  • August 1, 2018

@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
Forum|alt.badge.img+16
  • Legendary Contributor
  • 7880 replies
  • August 1, 2018

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.


Forum|alt.badge.img+15
  • Author
  • Contributor
  • 92 replies
  • August 1, 2018

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


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings