2

I tried running crontab on my Mac for the first time and got the following:

$ crontab -e
crontab: no crontab for User - using an empty one
crontab: subl -w: No such file or directory
crontab: "subl -w" exited with status 1

I've never used crontab on my Mac and have no idea why it's trying to reach the sublime command line tool.

However, if I type subl -w into my console, sublime opens right up.

What's going on here?

1 Answers1

3

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 EDITOR variable 
consists of multiple terms. You can work around this by creating a simple shell 
script that calls bbedit -w, then using the shell script as your EDITOR. e.g.:

                #!/bin/sh
                bbedit -w "$@"

Of course, for Sublime Text you can change bbedit to subl in that script.

Tony Williams
  • 12,142
  • 1
    Actually further testing revealed that it didn't work properly, you need to use the script as the "-w" is required otherwise crontab doesn't wait for your edits. – Tony Williams Jun 18 '18 at 02:52