Lorenz
Lorenz

Reputation: 483

How can I use mvim to edit my crontab on Mac OS X (10.6.6)

mvim is installed in /usr/local/bin/ but can not be used as either EDITOR or VISUAL:

$ mvim -f # works as expected

$ EDITOR="/usr/local/bin/mvim -f" crontab -e
crontab: /usr/local/bin/mvim -f: No such file or directory
crontab: "/usr/local/bin/mvim -f" exited with status 1

I tried single quotes and using VISUAL instead of EDITOR. Same result. I also tried googling, but apparently the -f flag works just fine for everybody else.

I use Mac OS 10.6.6 and zsh, but the problem is the same in bash.

Upvotes: 6

Views: 1682

Answers (3)

Elliot Plant
Elliot Plant

Reputation: 718

For those seeing this without mvim, you can use morton-fox's answer for any editor:

EDITOR=/usr/bin/vim crontab -e

Will use vim to open the crontab file

Upvotes: 1

bryan kennedy
bryan kennedy

Reputation: 7199

I am not sure if this is directly related to the problem you are having but I was seeing a similar error code when trying to edit my crontab. I realized I had a little conflict in my vimrc file related to the pathogen plugin. If you call:

filetype off

when it's already off you can cause problems that will make your Vim exit with errors. Sounds like your issue is fixed already, but since this shows up in searches related to this error code, I thought I would post it here.

Credit goes to commenters on this post - http://tooky.github.com/2010/04/08/there-was-a-problem-with-the-editor-vi-git-on-mac-os-x.html

Upvotes: 1

Morton Fox
Morton Fox

Reputation: 186

The problem is crontab expects to be able to run a program called "/usr/local/bin/mvim -f" if you supply that in the EDITOR environment variable.

To get around that, you could write a short shell script. For example, call this one mvimf:

#!/bin/bash
/usr/local/bin/mvim -f "$@"

Then you can run: EDITOR=/usr/local/bin/mvimf crontab -e

Upvotes: 5

Related Questions