108
votes
Accepted
Crontab Operation not permitted
In your case you have to add cron as "parent" app to the user's Security & Privacy > Privacy > Full Disk Access apps/execs.
Depending where to read the script from and where to ...
35
votes
Where is the cron log file in MacOSX Lion?
I was able to find cron-job log in,
/var/mail/{user-name}
Following is a cron job log I got for running a script through cron,
From [email protected] Fri Mar 2 10:00:00 2018
Return-Path: <...
29
votes
Accepted
On Catalina, how can a cronjob get permission to touch files on a USB disk?
You need to grant cron full disk access. Drag /usr/sbin/cron into the Full Disk Access area in System Preferences > Security & Privacy > Privacy tab.
Source: https://twitter.com/DaveWoodX/...
14
votes
Accepted
rsync in cron on Catalina no longer working
This requires adding cron to the Full Disk Access list.
Open System Preferences : Security & Privacy : Privacy : Full Disk Access
Both rsync and cron must be included on this list. Before ...
10
votes
'Operation not permitted' accessing SMB Share as root under Catalina
I had the same problem and it was fixed by granting »Full disk access« to Terminal in System preferences -> Security & Privacy -> Privacy and restarting Terminal.
Click the lock at the ...
10
votes
crontab doesn't seem to recognize `~`
The question proposed using ~/username/filename.txt instead of /Users/username/filename.txt, but the proposed syntax should instead be either ~username/filename.txt or ~/filename.txt. For an ...
9
votes
cron and "command not found"
When cron runs an event, it uses the default shell environment of the running UID. However, no "profile" customization is applied, i.e. your .bash_profile is not sourced and thus any PATH settings are ...
9
votes
Accepted
How do I know if a time machine backup is running?
The canonical way to check status of time machine is to use the utility and check status or for newer os check the current phase only:
tmutil status
tmutil currentphase
Now, you have to process ...
9
votes
Accepted
cronjobs do not run
I'd recommend a couple of things:
Make sure cron has Full Disk Access in the Privacy tab of System Preferences (see s/s below)
When creating commands in crontab, help yourself out by writing errors ...
8
votes
Accepted
Is cron command supposed to work like this?
You don't need to call cron directly. Any commands you want to run need to be added to the crontab of the user they should run as. You can edit your crontab by running
crontab -e
or, if you are an ...
7
votes
How to check if cron job works?
Your cron error message are sent to the mail account of the user that is running the cron job.
Type mail at the command line to see the messages. For a list of mail commands, see man mail.
You ...
7
votes
crontab doesn't seem to recognize `~`
~ is a symbol shells automatically expand to $HOME, a standard /bin/sh (which cron uses to run the commands) does not need to support ~ expansion. The portable way is to use $HOME instead in your ...
6
votes
Where is my crontab file?
It should be noted that if you aren't accustomed to using vim (the default crontab editor) then you can specify your editor as follows:
VISUAL=nano crontab -e
6
votes
Accepted
Write cron script to open and exit application
As an example, the following commands can be used in a shell script to accomplish what you've expressed.
/usr/bin/open -na "/Applications/Safari.app" "https://www.google.com/"
pid=$...
5
votes
Is cron command supposed to work like this?
On macOS High Sierra (and perhaps earlier), cron is disabled in some configurations. There is, however, still a LaunchDaemon for it.
Check to see if cron is enabled:
sudo launchctl list | grep cron
...
5
votes
Accepted
"cron" processes piling up
Redirect stderr to /dev/null as well as stdout:
* * * * * /usr/bin/defaults delete com.apple.Spotlight userHasMovedWindow &> /dev/null
* * * * * /usr/bin/defaults delete com.apple.Spotlight ...
5
votes
Accepted
"cron" processes spawning and piling up, but no crontab
So I found a relevant answer here:
Cron job keeps running, not in any crontabs
I don't think this question should be removed because this seems to be relevant to Catalina, even though it seems to be ...
5
votes
How create a crontab on mac?
This will indeed open a new crontab in vim (presuming you don't already have one)
crontab -e
If it creates a new crontab for you, it will start empty, hit the space bar to add something to the ...
4
votes
Accepted
How to get macOS Wi-Fi device name programmatically in Bash script?
In your question I know you used networksetup -listnetworkserviceorder however I'd use networksetup -listallhardwareports instead as it's easier to parse the output using awk, by itself, with a ...
4
votes
Accepted
Bash script for /etc/crontab
The script errors because you have split the command in two lines. Basically you want to remove the newlines between the PATH and the kextunload lines, so it looks like this:
#!/bin/sh
PATH=/usr/...
4
votes
error code 4960 when saving a .plist
You are trying to create a launch agent with:
the wrong extension (plis)
in the wrong folder (/Library/LaunchAgents/ (suggested by the visible plists: java oracle/microsoft? updater, google keystone ...
3
votes
Accepted
save mysql backup to afp network drive fails as cron job
Found the solution: The problem was, that the mysqldump command could not be find. I needed to add the absolute path to it /Applications/MySQLWorkbench.app/Contents/MacOS/mysqldump
Thanks to patrix ...
3
votes
How do I know if a time machine backup is running?
Undocumented tmutil status
There is an undocumented, and thus subject to change, tmutil status. This call returns the response:
Backup session status:
{
ClientID = "com.apple.backupd";
...
3
votes
Running Cron Job w/ Sudo permissions
If you want to specify the the root user's crontab, you have to use the -u option.
sudo crontab -e -u root
That said, there's a safer way to clean out your trash than just removing the whole ...
3
votes
How to access Keychain of my user from cron?
There is one another way of giving cron job the access to our keychains.
When you add the password using security add-generic-password -s SERVICE -a USERID -w PASSWORD, you have to first run the ...
3
votes
Accepted
How to access Keychain of my user from cron?
Read the --help of the command that you intended to use:
$ security delete-generic-password --help
delete-generic-password: illegal option -- -
Usage: delete-generic-password [-a account] [-s service]...
3
votes
Crontab task "LSOpenURLsWithRole() failed ... with error -600 for the file ..."
As noted in the other answer the error is because you are trying to run a GUI app when not logged in.
However in your case why are you using a GUI app (Terminal ) here.
Just call your scripts ...
3
votes
Can't open crontab
This is a known problem with crontab and the EDITOR variable which you must have set to subl -w. To quote from the man page of bbedit:
Some tools (notably crontab), will not work correctly if your ...
3
votes
Accepted
What is the best approach to ejecting disk while in sleep mode, scheduled?
I think the Energy Saver suggestion is a good place to start:
» System Preferences » Energy Saver » Schedule and set it for, say, 30 minutes before you want to leave for work.
However, I would not ...
3
votes
cron lacks permissions to run a script
It looks like the proper two programs to give full access to are:
cron
terminal.app
See rsync in cron on Catalina no longer working
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
cron × 148macos × 72
launchd × 27
terminal × 25
bash × 19
command-line × 13
applescript × 11
script × 10
sleep-wake × 8
permission × 7
mac × 5
email × 5
wifi × 4
backup × 4
mail.app × 4
python × 4
plist × 4
macbook-pro × 3
finder × 3
network × 3
automation × 3
logs × 3
sudo × 3
rsync × 3
hard-drive × 2