I am a total emacs newbie and am trying to figure my way around emacs(I am kinda liking it). Now my question is that when I type rails commands in my terminal, they work perfectly well.

user ~ $ rails -v
Rails 4.2.1

But when I run the same commands in eshell, I get:

Welcome to the Emacs shell

~/.emacs.d $ rails -v
rails: command not found

To my understanding, eshell is a shell within emacs. Right? Or I have it completely wrong?

  • Emacs uses PATH as defined by the environment it was started from. If you've changed PATH only in your shell, it will obviously not work.
    – wasamasa
    May 16, 2015 at 12:45
  • @wasamasa How do I make it work?
    – xandfury
    May 16, 2015 at 12:51

1 Answer 1


Eshell does not run your default shell, so it will ignore whatever you have set up in the shell rc script.

You can set environment variables in ~/.eshell/login or ~/.eshell/profile, use addpath PATH (for some string value of PATH), or add a hook to evaluate (setenv ...) with the appropriate values.

For a more regular shell I recommend using M-x shell, which just communicates with an external shell process.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.