8

When I try to open a file (e.g. test/test_sequence.rb) using Vim or MacVim I get the following error:

"test/test_sequence.rb" 109L, 3697C
Vim(let):E484: Can't open file /var/folders/zO/zOCN9kiiGD4keWX3TWYEh++++TI/-Tmp-/vzTkbXD/0

This seems only restricted to files which have some kind of syntax highlighting. I can still edit the file but I have to use :w! to write the changes the first time. I'm using vim on Mac OS X. I tried a lot of googling for this error with no luck and this has become really frustrating. Could anyone offer a fix for this?

EDIT: I don't get this error when editing syntax highlighted LaTeX files but do with syntax highlighted Ruby files.

3 Answers 3

6

Turns out the problem was with the shell. Vim was trying to use /bin/screen as the shell

set shell /bin/sh

In my vimrc fixed the problem.

5
  • 3
    Just hit this myself when I changed my login shell to fishshell. Thanks for the tip :)
    – Yeraze
    Nov 8, 2013 at 16:13
  • Same here, after setting default shell to fish it happened to me :)
    – imslavko
    Nov 23, 2013 at 20:54
  • 3
    Well, it had to add: set shell=/bin/bash.
    – paldepind
    Feb 19, 2014 at 8:19
  • for me the syntax had to be set shell=/bin/sh Nov 15, 2015 at 8:40
  • But the whole thing seems filetype=ruby-specific to me.
    – ThomasH
    Nov 26, 2015 at 15:58
1

I have found that if you su to a different user, processes trying to use temporary files may produce an error like /var/folders/zO/zOCN9kiiGD4keWX3TWYEh++++TI/-Tmp-/vzTkbXD/0: permission denied; the fix for this is to unset TMPDIR (which, I think, causes /tmp to be used instead), because the TMPDIR specified is specific to the old user and not writable by the current user.

You haven't said whether you're using su or any other user-switching, and the error message doesn't mention permission denied, but ...

3
  • Thanks for the suggestion. I've tried changing the location of $TMPDIR to /tmp. I instead get an error pointing to /tmp/vzTkbXD/0 now though. Sep 2, 2010 at 18:05
  • 1
    Try unset TMPDIR instead. And what is the error? If the message really doesn't show it, run sudo fs_usage MacVim (note that the named process must be already running) and note what the errno on its open() call is.
    – Kevin Reid
    Sep 3, 2010 at 1:42
  • Thank you for your continued suggestions to try to resolve this for me, it's really appreciated. I've tried unsetting $TMPDIR but this doesn't resolve the error either.Unfortunately I'm not familiar with the fs_usage command and I couldn't produce an error number for the open process in the fs_usage output. I've pasted the complete output of fs_usage here if this is of any use - cl.ly/5c01de97b2276a73b569 Sep 12, 2010 at 19:51
0

Vim is trying to open a swap file, have you tried repairing permissions?

1
  • 1
    Thanks for the suggestion. I've just run disk utility's repair permissions twice but I'm still seeing the same problem. Aug 23, 2010 at 21:31

You must log in to answer this question.

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