I'm looking for a script to toggle iCloud preferences in system preferences.

I need to automatically uncheck all the voices (Photos, Mail, Contacts, etc) leaving only iCloud Drive and Find My Mac.

In iCloud Drive settings I also need to uncheck everything, leaving only Desktop & Documents Folders

Is there a way to do so with terminal or applescript?


  • Can I ask why you need to automate this? It should be possible with UI scripting (developer.apple.com/library/archive/documentation/…), but it'll be much faster to just uncheck the boxes. (xkcd.com/1319) – slhck Jan 14 at 12:19
  • my company needs to clone a Mac mini several times a day to create perfect copies. The are all linked together with a unique iCloud ID with desktop and documents syncing, so every machine is always up to date. We are using Carbon Copy Cloner to do that, unfortunately it does not copy those settings – liuk Jan 14 at 17:10
  • haha, you graph is funny! unfortunately it does not apply here! ;-) – liuk Jan 14 at 17:12

See this answer on Apple.SE, which suggests:

tell application "System Preferences" to set current pane to pane "iCloud"
tell application "System Events"
    tell window "iCloud" of process "System Preferences"
        set btmmBox to checkbox 1 of UI element 1 of row 1 of table 1 of scroll area 1 of group 1
        tell btmmBox
            if not (its value as boolean) then click btmmBox
        end tell
        --get value of btmmBox
    end tell
end tell

This will only check the first element, i.e. iCloud Drive, but you can work your way through the others based on the syntax.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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