Mac OS X: Cannot edit crontab
I wanted to edit crontab for a user on Mountain Lion and it did not work. Repairing permissions with Disk Utility did not help. I saw following error messages:
$ crontab -e
crontab: no crontab for player - using an empty one
crontab: "/usr/bin/vi" exited with status 1
$ EDITOR=vim crontab -e
crontab: no crontab for player - using an empty one
crontab: temp file must be edited in place
$ EDITOR=mcedit crontab -e
crontab: no crontab for player - using an empty one
crontab: installing new crontab
crontab: tmp/tmp.13840: No such file or directory
crontab: edits left in /tmp/crontab.Gyxvel8v43
$ crontab path-to-file-to-replace-current-tab
crontab: tmp/tmp.13784: No such file or directory
To reduce the problem, I have used mcedit. I have found that someone had this issue in 2007 – UNSOLVED. If you were a programmer you would be suspicious about the path without the leading slash. But how to find the real path? I made me comfortable with dtruss (strace for Mac) but it did not move me forward, I just saw that it is problem when opening the file for writing. But hey, this is BSD! We should find sources … and indeed they are available. Now it took just a while to go through the C code and finally find file install_misc.sh.
The solution of this problem is to create missing tmp directory in /var/at!
mkdir /var/at/tmp
chmod 700 /var/at/tmp
I have no idea where I have lost the tmp directory. But I should not be supposed to drill into the source code. Am I?
UPDATED: I believe this problem was caused by my attempt to wipe Parallels out of the system. I was deleting all files installed by the package and afterwards I was deleting empty directories system wide.
I managed to fix this by putting “filetype = off” before “filetype = on” in my vimrc. “filetype = on” is required in things like vundle.
I have updated the post, I do not think it was related to vim configuration, it was rather my mistake when doing too aggressive clean up.
EDITOR=vi crontab -e
vi on my system executes vim and this did not work