/usr/bin/nano makes the
crontab -eworking for me!
I ran in a similar issue on Monterey in
zsh but it was due to
SublimeText was configured as default editor:
When trying to edit the crontab of either user or root I got:
crontab -e # or
sudo crontab -e
crontab: subl -w: No such file or directory
crontab: "subl -w" exited with status 1
Neither solutions from other suggestions worked:
- to change the
$VISUAL editor variable to
- omitting the
- editing the sudoers file via
visudo helped not (to get
visudo to work, I had to set both
$VISUAL to nothing)
actually the suggested line was already present!
Defaults env_keep += "EDITOR VISUAL"
Possible low level shell path issue
At the end it turns out to be related to the regular $PATH is not to be accessible by the
crontab command. Even symlinks seemed not to work until I set the $VISUAL setting different from $EDITOR to
/usr/bin/nano. Then it started working using
nano with an explicit absolute path.
$EDITOR Setting can be preserved
crontab usage it is irrelevant if
$EDITOR is set to
subl -w, both are suitable!
To make these changes permanent you have to put the export lines in your terminal startup file (
~/.zshrc or ``~/.profile depending on your setup)
Make sure you granted
Full Disk Access to
cron in ``System Preferences```
Giving cron full disk access
If you are using [[macOS]] [[Catalina]] (or higher) you will also need to give the
cron service Full Disk Access.
- Go to the System Preferences and select Security & Privacy.
- In the left-hand column, select
Full Disk Access, click the
padlock icon, enter your password and click on the
plus icon for a file browser to appear.
- When the file browser appears, press
⌘ ⇧ G to open the
go to folder dialog and type:
Go to close the dialog and confirm that
cron appears in the list of apps that have full disk access in the
Security & Privacy window.
- Repeat with