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?

4
  • 1
    What is the value of EDITOR (run echo $EDITOR)?
    – nohillside
    Jun 16, 2018 at 23:15
  • 1
    That returns subl -w. Can't remember when I changed that, but this is the first issue I've had with it. Jun 16, 2018 at 23:16
  • 1
    Also, crontab is deprecated in macOS. You should start transitioning over to lauchd
    – Allan
    Jun 16, 2018 at 23:19
  • What does which subl show?
    – mmmmmm
    Jun 16, 2018 at 23:32

1 Answer 1

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.

1
  • 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. Jun 18, 2018 at 2:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .