FINALLY! SOME UPDATES! This website is being reconstructed. Some content will go away soon. If you want to see my new stuff, visit my github:

November 3, 2013

Installing Ruby the Right Way: Epilogue

As much as I like to write about how to do things on this blog, sometimes I don't explain how I did things exactly as I though I explained them, mainly because later on I found out that I was most likely wrong about some things or there were other factors I didn't anticipate at the time the were done.

For instance, when I was doing the RVM install, I was using tmux inside my bash shell. To which, either because I am using Lubuntu or this is part of Ubuntu/Gnome Terminal's set up, in bash the terminal you are using (which you can find out what terminal you are using by typing echo $TERM) the xterm terminal, but when you are using tmux, your terminal is screen. xterm and screen both use bash as their shell of choice by default. However, depending on your distro more than likely, xterm will strictly use ~/.profile to load bash shell preferences whereas screen continues to follow the more traditional rules that state that ~/.profile is read only if ~/.bash_profile does not exists for screen to read at the creation of a new terminal.

So it would seem pretty simple to append the following line to the end of ~/.bashrc, which is loaded when ~/.profile is read.

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
We could have just echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*' >> ~/.bashrc

Yeah, we could have, figcaption, but what a mess that was! By the way, if that line is in ~/.profile or ~/.bash_profile, comment it out.

At any rate, back at ~/.bash_profile, the following line should be at the beginning of the file.

source $HOME/.profile
It's fixed now, right?

Actually, no. While this is necessary to make sure that the settings many of us are used to using in bash (i.e. using colors when listing what file type and making sure that common alias commands are used) there is one issue that still stands out. If you have a directory called ~/bin to run programs local to your home directory, that path is tacked on at the beginning of $PATH and if you haven't figured out by now, RVM wants to be the first thing that is read otherwise when you run rvm , you will get that Path Warning about how it's not the first item in the $PATH string.

While I'm not completely certain that it has to be, whether or not you want to do this next part is up to you. At this point, I'm of the opinion that if RVM want's to be first, it's requests for preferential positioning should be denied. RVM's Ruby is used in xterm and screen now. That's what matters. You can use a different terminal emulator like urxvt (or as Ubuntu calls it UXTerm), and RVM's Ruby would be shown when executing which ruby. Besides, we just want to use RVM to handle the more important installations like Ruby, JRuby, and Rails. Everything else should be done using gem. Right now, I'd really like to get gems for Tk and OpenGL set up.

But like I said, if you still want to appease RVM, you can either remove ~/bin (which more than likely you don't want to; I wouldn't), or ignore RVM's "Me first!" messages.

Unless I encounter some problem that requires RVM's paths to be first explicitly, it will just have to deal with where it is.

One more thing, to get RVM's version of JRuby working by default use the following command.

rvm use jruby --default
Two great things that work great together!


Under Construction