Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question

3 Answers 3

up vote 4 down vote accepted

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.

share|improve this answer
2  
Just hit this myself when I changed my login shell to fishshell. Thanks for the tip :) –  Yeraze Nov 8 '13 at 16:13
    
Same here, after setting default shell to fish it happened to me :) –  imslavko Nov 23 '13 at 20:54
1  
Well, it had to add: set shell=/bin/bash. –  paldepind Feb 19 at 8:19
    
@paldepind Thank you, sir! That helped me. –  Nek Jun 27 at 18:02

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 ...

share|improve this answer
    
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. –  Michael Barton Sep 2 '10 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 '10 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 –  Michael Barton Sep 12 '10 at 19:51

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

share|improve this answer
    
Thanks for the suggestion. I've just run disk utility's repair permissions twice but I'm still seeing the same problem. –  Michael Barton Aug 23 '10 at 21:31

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.