Harry R. Schwartz

Software engineer, nominal scientist, gentleman of the internet. Member, ←Hotline Webring→.

1B41 8F2C 23DE DD9C 807E A74F 841B 3DAE 25AE 721B

Making Your Emacs Shell a Login Shell

Published 15 Mar 2014. Tags: emacs.

I like to use term-mode and multi-term to handle shells in Emacs. However, when using RVM to handle different versions of Ruby, opening up a shell gave me the following error:

Warning! PATH is not properly set up, '/Users/hrs/.rvm/gems/ruby-2.0.0-p353/bin' is not at first place,
usually this is caused by shell initialization files - check them for 'PATH=...' entries,
it might also help to re-add RVM to your dotfiles: 'rvm get stable --auto-dotfiles',
to fix temporarily in this shell session run: 'rvm use ruby-2.0.0-p353'.

This seemed really baffling, because I was sure my .bashrc was configured correctly, and I didn’t see any errors in a non-Emacs terminal.

Eventually I figured out that I wasn’t configured to use a login shell, which sources dotfiles differently. This was easily solved by setting the multi-term-program-switches flag:

(setq multi-term-program-switches "--login")

Now, creating a new multi-term instance runs bash with the --login flag, sourcing .bashrc correctly.

Boom! No more errors!