I have some launchctl scripts on Mojave that I am trying to now run on Catalina, but can't seem to get them to run. I made myself a very simple little plist as follows
<?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">
<dict>
<key>Label</key>
<string>local.moveit</string>
<key>StandardOutPath</key>
<string>/Users/pheon/Library/Logs/local-moveit-stout.log</string>
<key>StandardErrorPath</key>
<string>/Users/pheon/Library/Logs/local-moveit-stderr.log</string>
<key>ProgramArguments</key>
<array>
<string>mv</string>
<string>/Users/pheon/Desktop/test/fileA</string>
<string>/Users/pheon/Desktop/test/fileB</string>
</array>
<key>StartCalendarInterval</key>
<dict>
<key>Minute</key>
<integer>1</integer>
</dict>
</dict>
</plist>
Then I loaded it with
launchctl load local.moveit.plist
Restarted my machine.
Checked it was running.
$ launchctl list | grep moveit
- 0 local.moveit
It is simply supposed to rename a file (which does exists), but it doesn't do anything, it doesn't report any errors. It seems dead.
I had read that there could be permission issues, so I gave mv
, launchctr
, sh
and zsh
"Full Disk Access" in System Preferences. I also downloaded LaunchControl.app to see if that would help. But it still doesn't work, and nothing is reporting that anything is amiss.
I have the following questions.
- How do I get this to work?
- What is it with this permissions thing? Is it safe to give those apps "Full Disk Access". Should I turn SIP off and on again? (What does that do anyway?)
ETA.
An error message finally turned up in the log.
mv: rename /Users/pheon/Desktop/test/fileA to /Users/pheon/Desktop/test/fileB: Operation not permitted
launchd
to call the script. Also, aStartCalendarInterval
of "1" means that it runs on the 1st minute of every hour (12:01, 1:01, 2:01, etc.), not that it runs it every minute. Did you wait until that time to see if it worked?