Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RVM installed ruby not found after restart of shell Ubuntu 16

I've installed RVM and ruby and at first it seemed to work, but whenever I open a new shell tab or window only rvm can be found, not ruby.

Running rvm -v gives me a nice little output:

rvm 1.27.0 (latest) by Wayne E. Seguin <[email protected]>, Michal Papis <[email protected]> [https://rvm.io/]

but running ruby -v, gem -v or rails -v gives me an error telling me to apt-get install ruby/rails.

I've installed rvm through the following commands:

sudo apt-get install libgdbm-dev libncurses5-dev automake libtool bison libffi-dev
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
curl -sSL https://get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm

I installed ruby like so:

rvm install 2.3.1
rvm use 2.3.1 --default

Rails was installed with the command:

gem install rails

What I've tried:

I've checked my .bashrc .bash_profile and my .profile and it's set up nicely with the following:

.bashrc and .profile :

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

.bash_profile:

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

What kinda works:

Running the line source ~/.rvm/scripts/rvm allows ruby, gem, and rails to be found again, but you have to repeat this is every new tab or window.

How can I fix so that rvm installed modules will work automatically?

like image 640
Gemtastic Avatar asked Dec 05 '22 17:12

Gemtastic


1 Answers

Turns out everything is set up nicely and correct. If you have this issue it's an issue with your shell settings. You need to set your profile to login shell.

How to set this in the standard terminal on Ubuntu's standard GUI

(GNOME terminal Unity)

Access your settings by going to the menu and pic Terminal > Preferences.

In the window that pops up, select Profiles in the tab menu. Pick if you want to create a new profile or edit the existing default one. In the window that comes up (it's the same regardless of your pic) go to the tab Command and enable Run command as a login shell.

Restart your terminal and you should find that your rvm commands are now working.

like image 197
Gemtastic Avatar answered Jan 11 '23 23:01

Gemtastic