I'm trying to find on a Mac computer if the current user has iCloud Documents enabled. I found the plist where this is located (MobileMeAccounts.plist), but I could use some help with the plistbuddy syntax to target down in the tree.

Here is part of the script that I have so far:


# Purpose: Grab iCloud Document Status


if [[ -e "/Users/*loggedInUser*/Library/Preferences/MobileMeAccounts.plist" ]]; then

iCloudStatus=`$plistBud -c "print :Accounts:Services:MOBILE_DOCUMENTS" /Users/$loggedInUser/Library/Preferences/MobileMeAccounts.plist`

iCloudDocuments="Not Enabled"


echo "$iCloudStatus"

I am specifically looking for the following code to be true:


Here is the plist. If you scroll down you'll see the "MOBILE_DOCUMENTS" with it being enabled:

<?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">
        <string>User Name</string>

1 Answer 1


You're almost there.

The trick is that you have to specify which object you want in each array. Add this index in the XML path and you're good.

To get the list of items in the array:

/usr/libexec/PlistBuddy -c "print :Accounts:0:Services" ~/Library/Preferences/MobileMeAccounts.plist

In my case MOBILE_DOCUMENTS is the first item, so it is of index 0 (second item would be index 1, third item index 2, etc).

This works for me:

/usr/libexec/PlistBuddy -c "print :Accounts:0:Services:0:Enabled" ~/Library/Preferences/MobileMeAccounts.plist

will give "false" or "true".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.