0

I was using an App created with Automator to quikly disable and enable Time Machine backups on my Mac with just one click. I was using a command that for some reason seems to doesn't work since I updated my system to Monterey.

I was using this code:

on run {input, parameters}
    
    do shell script "sudo tmutil disable" user name "xxxxx" password "xxxxx" with administrator privileges
    
    return input
end run

Now I'm receiving errors when trying to run the script. Automator says: "Sintaxis error. tmutil: disable requieres Full Disk Access privileges. To allow this operation, select Full Disk Access in the Privacy tab of the Security & Privacy preference pane, and add Terminal to the list of applications which are allowed Full Disk Access."

I've already added several times Terminal, Automator and even the App created by Automator to the different tabs of Privacy on System Preferences, including Full Disk Access and still can't use this command like before.

What else can I do?

Thank you!

7
  • 1
    What is the purpose of 'quickly disabling and enabling' TM backups? I can't think why that would be necessary.
    – benwiggy
    Apr 26, 2022 at 12:35
  • 1
    It's something that I usually do two or three times everyday. When I'm mixing/producing with Logic Pro X I don't want that Time Machine is creating backups, because it consumes a lot of resources that I need to work on my projects. When Time Machine starts a backup, I start suffering problems playing the Logic Pro project. So I just want to run a short cut or App before start working in Logic Pro X to disable Time Machine and another one when I finish to re-enable it. Apr 26, 2022 at 12:52
  • Same thing occurs with Final Cut. My wife's been doing some editing for a yearly Gala video, and there were frequent beach balling that drove her crazy. I happened to notice that TM was doing its thing when this was happening, so she knows to dismount the TM drive before she begins her work.
    – IconDaemon
    Apr 26, 2022 at 15:33
  • Not an answer to your original question but if you have TM in the Menu bar you can just click it, select Open Preferences, then uncheck/check the the checkbox to enable/disable automatic TM backups.
    – At0mic
    Apr 26, 2022 at 18:38
  • Another option if you still want to use AppleScript is to, similar to @IconDaemon's suggestion, just unmount the drive. Note that this is different from ejecting, as you can simply remount an unmounted partition.
    – At0mic
    Apr 26, 2022 at 18:41

1 Answer 1

0

A while back, I was having similar problems. I resorted to using this following AppleScript code to toggle "Back Up Automatically" to on or off.

if application "System Preferences" is running then
    do shell script "killall " & quoted form of "System Preferences"
    repeat until application "System Preferences" is not running
        delay 0.1
    end repeat
end if

tell application "System Preferences" to reveal ¬
    anchor "main" of pane id "com.apple.prefs.backup"

tell application "System Events"
    repeat while not (exists of checkbox "Back Up Automatically" of ¬
        window "Time Machine" of application process "System Preferences")
        delay 0.1
    end repeat
    click checkbox "Back Up Automatically" of window "Time Machine" of ¬
        application process "System Preferences"
end tell
delay 0.1
do shell script "killall " & quoted form of "System Preferences"

OR This following version of the code will not toggle on or off but will only disable "Back Up Automatically" if it is already enabled.

if application "System Preferences" is running then
    do shell script "killall " & quoted form of "System Preferences"
    repeat until application "System Preferences" is not running
        delay 0.1
    end repeat
end if

tell application "System Preferences" to reveal ¬
    anchor "main" of pane id "com.apple.prefs.backup"

tell application "System Events"
    repeat while not (exists of checkbox "Back Up Automatically" of ¬
        window "Time Machine" of application process "System Preferences")
        delay 0.1
    end repeat
    if get value of checkbox "Back Up Automatically" of window ¬
        "Time Machine" of application process "System Preferences" is 1 then
        click checkbox "Back Up Automatically" of window ¬
            "Time Machine" of application process "System Preferences"
    end if
end tell
delay 0.1
do shell script "killall " & quoted form of "System Preferences"

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .