Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RVM not reading .ruby-gemset files when I open a new tab in my terminal

Tags:

ruby

rvm

I have a new install of RVM on Fedora 20.

If I cd to myapp, RVM will read the .ruby-gemset file and switch to the appropriate gemset, but if I open a new tab (control-shift-t) and run rvm gemset list I find that it's using the default gemset.

Does any have any idea what I might be doing wrong?

I've got the following in .bashrc

# .bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
    . /etc/bashrc
fi

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

export PATH
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"

And I've got more ore less identical content in .bash_profile

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
    . ~/.bashrc
fi

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

export PATH

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"

The terminal is the bog standard one that comes with Fedora.

like image 409
stephenmurdoch Avatar asked Mar 24 '14 00:03

stephenmurdoch


2 Answers

Putting cd . to ~/.profile fixed the issue for me.

If you are using zsh, put cd . to ~/.zlogin.

like image 119
TeWu Avatar answered Dec 04 '22 21:12

TeWu


I had the same issue, and I was able to fix it. However, my exact solution might be useless for you. I had oh-my-zsh installed. It looks like during installation, it was trying to mimic my .bashrc files and it screwed PATH variable for me. Here's the line I had trouble with:

export PATH="/home/alexander/.rvm/gems/ruby-2.1.1@security/bin:/home/alexander/.rvm/gems/ruby-2.1.1@global/bin:/home/alexander/.rvm/rubies/ruby-2.1.1/bin:/home/alexander/.nvm/v0.10.25/bin:/home/alexander/work/gc-sdk/google-cloud-sdk/bin:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/alexander/.rvm/bin"

So, you need to verify if your PATH variable isn't tempered with. And you need to let RVM configure it for you. Both these things can be done with a simple command in your terminal (assuming you have RVM installed):

rvm get stable --auto-dotfiles

Also, there're couple of issues created on GitHub. The common advice is to use command from above and switch your terminal to login shell.

Hope it helps!

like image 23
marvelousNinja Avatar answered Dec 04 '22 21:12

marvelousNinja