I am running bash in emacs on osx and its pulling gems from a different place then terminal.app
in bash:
which gem
/usr/bin/gem
in terminal:
which gem
/opt/local/bin/gem
How do I change the bash to match terminals?
I am running bash in emacs on osx and its pulling gems from a different place then terminal.app
in bash:
which gem
/usr/bin/gem
in terminal:
which gem
/opt/local/bin/gem
How do I change the bash to match terminals?
I'm guessing the $PATH
is different in the emacs bash shell. You can check it out by running this command in each.
echo $PATH
This is the lookup path used to find commands. You need to include /opt/local/bin into this.
export PATH="/opt/local/bin:$PATH"
Place that line inside of your ~/.bashrc
file and it should be picked up by bash when used in emacs (unless it is being run under a different user or something).
Update:
As Singletoned mentioned in the comments, Emacs will not load the ~/.bash_profile
or ~/.profile
but the Terminal will. This file likely already contains this PATH
definition causing the two to have a different behavior.
I recommend moving the PATH definition from bash_profile
file into bashrc
. However Terminal will not load bashrc
if bash_profile
exists.
The solution is to add this to ~/.bash_profile
.
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
You can then move everything else into bashrc
which will be included into bash_profile
.