Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing RVM (Ruby Version Manager)

Tags:

ruby

Can someone please translate this into manageable steps I need to take:

~ Wayne

You must now finish the install manually:
1) Place the folowing line at the end of your shell's loading files(.bashrc or .bash_profile for bash and .zshrc for zsh), after all path/variable settings:
     [[ -s $HOME/.rvm/scripts/rvm ]] && source $HOME/.rvm/scripts/rvm
   Please note that this must only occur once - so, you only need to add it the first time you install rvm.
2) Ensure that there is no 'return' from inside the .bashrc file. (otherwise rvm will be prevented from working properly).
   This means that if you see '[ -z  ] && return' then you must change this line to:
   if [[ ! -z  ]] ; then
     ... original content that was below the && return line ...
   fi # <= be sure to close the if.
   #EOF .bashrc
   Be absolutely *sure* to REMOVE the '&& return'.
   If you wish to DRY up your config you can 'source ~/.bashrc' at the bottom of your .bash_profile.
   placing all non-interactive items in the .bashrc, including the 'source' line above
3) Then CLOSE THIS SHELL and open a new one in order to use rvm.
[ -z "$PS1" ] && return


WARNING:  you have a 'return' statement in your .bashrc, likely this will cause untold havoc.
   This means that if you see '[ -z $PS1 ] && return' then you must change this line to:
   if [[ -n $PS1 ]] ; then
     ... original content that was below the && return line ...
   fi # <= be sure to close the if.
   #EOF .bashrc
Even if you use zsh you should still adjust the .bashrc as above.
If you have any questions about this please visit #rvm on irc.freenode.net.

Installation of RVM to /home/kapplej/.rvm/ is complete.

I'm a complete newbie, so I am not even sure which one is shell's loading file, and how do I edit it?

like image 759
ken.truong123 Avatar asked Dec 13 '22 20:12

ken.truong123


2 Answers

I found out how to do this, hope this saves someone time:

to install RVM, enter the following in your terminal:

bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )

once you install rvm,

depending on which text editor you are using, I am using mate, so I typed in:

mate .bashrc

then once your text editor window opens up, copy and paste this line into it:

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

now save and close that window.

then repeat for:

mate .bash_profile

close that terminal and restart a new terminal

type in:

rvm use 1.9.1 (or 1.9.2)

then type in:

ruby -v

and you should see ruby1.9.1

to get back to default, type:

rvm default

now you should get ruby 1.8.6 (or 1.8.7 depending on your default).

like image 176
ken.truong123 Avatar answered Jan 02 '23 08:01

ken.truong123


I was having trouble with this same step from the RVM website:

The first time you install RVM, you must put the following line into your profile at the very end, after all path loads etc: [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"

Finally got it working after inserting that line into the .profile file, .bash_profile, and .bashrc files in the home directory of my user on OS X.

It seems like all of these are not necessary. Since the RVM website only says "put the following line into your profile" it's sort of misleading to a noob like me that doesn't really know what my profile is.

Can someone tell me which of these files (profile file, .bash_profile, and .bashrc files) that I can remove that line from?

like image 39
Lee McAlilly Avatar answered Jan 02 '23 09:01

Lee McAlilly