OSX mojave: "crontab: tmp/tmp.X: Operation not permitted"
The short answer:
Go to System Preferences > Security & Privacy and give Full Disk Access to Terminal.
The long answer:
- Pull down the Apple menu and choose ‘System Preferences’
- Choose “Security & Privacy” control panel
- Now select the “Privacy” tab, then from the left-side menu select “Full Disk Access”
- Click the lock icon in the lower left corner of the preference panel and authenticate with an admin level login
- Now click the [+] plus button to add an application with full disk access
- Navigate to the /Applications/Utilities/ folder and choose “Terminal” to grant Terminal with Full Disk Access privileges
- Relaunch Terminal, the “Operation not permitted” error messages will be gone
Another approach without requiring any permission changes, which relies upon the fact that
sshd is already enabled for 'Full Disk Access', is to perform the crontab updates via ssh to localhost (provided Remote Login/ssh is enabled in Sharing System preferences) e.g:
ssh localhost crontab -e
I had to add
cron to System Preferences > Security & Privacy > Full Disk Access
- Find privacy preferences: CMD + Space, "priv"
- Unlock preferences for Full Disk Access and open selection menu
- In selection menu press CMD + Shift + . to unhide hidden files and navigate to
/usr/sbin/cron. (You may check your
cronexecutable location by running
$ which cronin terminal)
The sandbox is preventing you from writing the crontab. If you run the crontab command…
- using Terminal on local machine: System Preferences > Security & Privacy and give Full Disk Access to Terminal
- using a third party terminal app: System Preferences > Security & Privacy and give Full Disk Access to third party terminal app
- via ssh from another machine: it should work (see @Pierz' answer)
- from the
screencommand: either log out of
screenor use @Pierz' answer.