Reputation: 21795
I'm trying to set $PATH variable in MacVim to the same value it has in a Terminal.
From these sources I wrote in ~/.zprofile
export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
eval "$(rbenv init -)" # this makes rbenv work
### Added by the Heroku Toolbelt
export PATH="/usr/local/heroku/bin:$PATH"
echo $PATH >> ~/path # for debugging purposes
And this are my results, in ~/path $PATH is correctly defined:
/usr/local/heroku/bin:/Users/pills/.rbenv/shims:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
But when I do !echo $PATH
in MacVim I get a twisted value:
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/heroku/bin:/Users/pills/.rbenv/shims
I saw from https://superuser.com/a/47166/145603 how $PATH is set, but I don't get why I'm having this behaviour. Can someone help me with this?
Upvotes: 1
Views: 2379
Reputation: 41
I wrote about my experience with this same issue in my blog. It's pretty detailed and I believe it's worth reading the entire post to better understand the root cause with a solution on how to properly fix it at the end.
Hint - The problem has to do with the path_helper
command that is executed in both /etc/zshenv
and /etc/zprofile
.
Upvotes: 0
Reputation: 15209
You're using zsh, it seems. In recent OS X releases, Apple ships a misconfiguration in the form of /etc/zshenv
. You should fix that with
sudo mv /etc/zshenv /etc/zprofile
If you still have issues with misconfigured PATH in Vim, try setting this in ~/.vimrc
:
set shell=bash " avoids munging PATH under zsh
let g:is_bash=1 " default shell syntax
If you do this, ensure that your ~/.bashrc
is also configured for rbenv the same way your ~/.zprofile
is.
For more information about which shell initialization files get sourced when, refer to the Unix shell initialization guide
Upvotes: 2