Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Open new tab terminal reset gemset by rvm

When I open terminal then enter to the rails application, the rvm will load the gemset in .ruby-gemset file as the following:

> cd my_application/ 
> rvm gemset list

The output as the following:

gemsets for ruby-2.2.2 (found in /home/yakout/.rvm/gems/ruby-2.2.2)
   (default)
=> my_gemset
   global

Then I open new tab in terminal, and run rvm gemset list, the output will be:

gemsets for ruby-2.2.1 (found in /home/yakout/.rvm/gems/ruby-2.2.1)
=> (default)
   global

I put the following line in .profile file:

export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*

And I put the following lines in .bash_profile file:

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*

And I put the following line in .bashrc file:

PATH=$PATH:$HOME/.rvm/bin

And I changed the preferences of my terminal by: Edit -> Preferences -> Title and Command tab -> Run command as a login shell.

How can I make rvm load the current gemset when I open new tab in terminal ?

like image 658
Mohamed Yakout Avatar asked Oct 06 '15 13:10

Mohamed Yakout


1 Answers

There is a workaround to get the right gemset when you open a new tab. Add this line at the end of your ~/.profile

cd .

I got this from https://github.com/rvm/rvm/issues/2527

like image 79
patdec Avatar answered Oct 03 '22 18:10

patdec