$PATH in Vim doesn't match Terminal
MacVim appears to be getting the $PATH in a way that ignores a regular user's custom dotfiles.
I can't say why they prefer to do it this way, but it appears to be true. In the preferences (under the Advanced tab), you can choose to "Launch Vim processes in a login shell", but it only improves the $PATH
slightly for me.
The best I can tell, MacVim uses /usr/libexec/path_helper
- which in turn uses the items found (1) in the /etc/paths
file and (2) anything additional found in the /etc/paths.d/
directory. Any changes made in a user's home directory (via .profile
or the like) is ignored.
In a nutshell, you get the OSX defaults, plus any applications that add themselves to /etc/paths.d
. (For example, MacTex does so on my system.) So if you want to adjust your MacVim path, one way would be to add a file with items to /etc/paths.d
. (I wouldn't directly edit /etc/paths
since then you run the risk of the changes being undone by system updates.)
Thanks for letting me know this. I'm off to file a wishlist bug at MacVim.
BTW, the "Launch Vim processes in a login shell" preference is no longer available in MacVim (at least not v7.3). I see that launching MacVim from the Finder gets the wrong path, but launching it from a shell (as "mvim") gets the correct path.
It's not sourced from .bash_profile, but you can use this in your .vimrc:
let $PATH=$PATH . ':/blah/foo'
You have to have the : or it won't be a correct PATH variable.