Why I've got no crontab entry on OS X when using vim?

前端 未结 12 1783
执念已碎
执念已碎 2020-12-07 07:41

I would like to use cron on my Mac. I choose it over launchd, because I want to be able to use my new knowledge on Linux as well. However, I cannot seem to get

12条回答
  •  天涯浪人
    2020-12-07 08:10

    The above has a mix of correct answers. What worked for me for having the exact same errors are:

    1) edit your bash config file

    $ cd ~ && vim .bashrc

    2) in your bash config file, make sure default editor is vim rather than vi (which causes the problem)

    export EDITOR=vim

    3) edit your vim config file

    $cd ~ && vim .vimrc

    4) make sure set backupcopy is yes in your .vimrc

    set backupcopy=yes

    5) restart terminal

    6) now try crontab edit

    $ crontab -e

    10 * * * * echo "hello world"

    You should see that it creates the crontab file correctly. If you exit vim (either ZZ or :wq) and list crontab with following command; you should see the new cron job. Hope this helps.

    $ crontab -l

提交回复
热议问题