Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

$PATH variable not properly set in gvim/MacVim when it is opened from the finder

I am using MacVim (basically gvim for the mac).

If I open macvim from the command line then my $PATH variable will be properly set.

If I open macvim via point and click with the finder, the $PATH variable will NOT be properly set.

Can anyone give me some insight?

Note: I know at least part of my path is set in ~/.bashrc, but I am not sure where the rest of it is set.


Examples:

If I open macvim from the terminal:

% gvim basic.tex 

And then in MacVim I go:

:!echo $PATH
/opt/local/bin:/opt/local/sbin:/sw/bin:/sw/sbin:/Applications/MacVim.app/Contents/M
acOS:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/texbin:/usr/X11R6/bin 

This is the right path.


When I open the file with the mouse (in finder)

When I go:

:!echo $PATH
/usr/bin:/bin:/usr/sbin:/sbin  

It gives me a little path. Why?

like image 202
sixtyfootersdude Avatar asked Jul 27 '10 14:07

sixtyfootersdude


2 Answers

I had this same issue but it only appeared after setting my default shell to zsh like so

export SHELL=/bin/zsh

It seems that there is a bug in the OS X zsh setup. The work around in brief is to merge /etc/zshenv into /etc/zprofile. In my case I didn't have a /etc/zprofile so just moving over the file did the trick:

sudo mv /etc/zshenv /etc/zprofile

This post describes the solution in more detail.

like image 80
Tim Clem Avatar answered Oct 16 '22 03:10

Tim Clem


For me, simply creating a new symbolic link from .zprofile to .zshrc did the trick:

ln -s ~/.zshrc ~/.zprofile
like image 20
adampasz Avatar answered Oct 16 '22 01:10

adampasz