How to make eshell pick up the right PATH
- Context:
- a freshly installed Emacs on Mac OS X.
Itch:- the PATH is the default system path, not that one you get in your terminal:
Not good.~ $ echo $PATH /usr/bin:/bin:/usr/sbin:/sbin ~ $ bash -l -c "echo \$PATH" /Users/mike/.rvm/gems/ruby-1.9.2-p180/bin: /Users/mike/.rvm/gems/ruby-1.9.2-p180@global/bin: /Users/mike/.rvm/rubies/ruby-1.9.2-p180/bin:/Users/mike/.rvm/bin: /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin: /usr/X11/bin:/opt/local/bin:/usr/local/cuda/bin:/Users/mike/bin ~ $ rvm rvm: command not found
Scratch:- Now here's the choice: either you fiddle with .MacOSX/environment.plist or use a quick and dirty sub-shell hack. I chose the latter for the sake of not touching XML. The idea is to call bash directly from Emacs and ask it for the right PATH:
Add the line above to your ~/.emacs and the next time you start eshell you will see:(setenv "PATH" (shell-command-to-string "/bin/bash -l -c 'echo -n $PATH'"))
Schnell und lustig!~ $ echo $PATH /Users/mike/.rvm/gems/ruby-1.9.2-p180/bin: /Users/mike/.rvm/gems/ruby-1.9.2-p180@global/bin: /Users/mike/.rvm/rubies/ruby-1.9.2-p180/bin:/Users/mike/.rvm/bin: /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin: /usr/X11/bin:/opt/local/bin:/usr/local/cuda/bin:/Users/mike/bin ~ $ rvm = rvm * http://github.com/wayneeseguin/rvm ........... blah blah blah... ............ limitations under the License.