# rvm and Ruby questions



## murias (Jan 20, 2013)

Hi,

I have finally decided to bite the bullet and install Ruby on a new server I am building.  Any other time I have tried, it failed, and never went back to it.

I found a couple of decent tutorials on how to install Ruby with rvm.  I did follow them, and wow, it installed v 1.9.3-p375.  Nice.

But I have a few questions, hoping to find the answers.  Cannot seem to find them with google.

Rvm is nice, but the system does not "know" that ruby is installed.  If I want to install anything else which requires Ruby, what is the best method to go about this?  Should I put a symlink somewhere in /usr/local/bin, lib, or share?  Same would then apply if a user logging into the machine via ssh wanted to use ruby for compass or something, do I just make sure rvm/.rvm is in everyones path?  Again, same with gems.  What about the shared lib so that apache can make use of ruby?

Lastly, a question about dependencies.  when I did the rvm install, it gave a decent sized list of dependencies, but only downloaded yaml.  I know I do not have all those deps installed on the machine currently, but I do know that any deps listed for the FreeBSD port are installed.  Should I make sure that I go ahead and install the deps that rvm listed?

Thank you for your time in reading.  I am more advanced on FreeBSD than this all sounds here, just no exp with Ruby as of yet... But trying to work on that.

Cheers
Murias


----------



## UNIXgod (Jan 20, 2013)

murias said:
			
		

> Hi,
> 
> I have finally decided to bite the bullet and install Ruby on a new server I am building.  Any other time I have tried, it failed, and never went back to it.
> 
> ...



Hello Murias 

For rails you will need node and sqlite on the system. I've only used rvm for development purposes and testing but you are correct that rvm will need to be in the users paths. 

You may need to install later rubies with the clang flag in rvm. You have to remember what the tool really is. Ultimately it started off being a way to trip up the environment to work with different rubies. For deployment you should look into bundler as it's goal is to provide the gem dependencies inside the application space vs global. Bundler also allows fixed versions of gems within the application space. Also consider using freebsd jails as well. Many people used them before tools like rvm where available and worked well for me when I was new to ruby as well.


----------



## murias (Jan 21, 2013)

*Thank You*

Thank you for the reply and answer.  I'm giving it a go and will report back.

From my pokings round the net, this bit of info will most likely be useful to others also.

Cheers
Murias


----------



## Majorix (Jan 22, 2013)

Are you sure you installed patchlevel 375? Is that a snapshot or something? Because the latest available over at The Official Ruby Website is p374.

I have been interested in Ruby for over 6 years now, but only really picked it up in the last few months. However, in none of the machines I used it (FreeBSD, several Linux distros, and even Windows 7) I never tried rvm. I don't really like the idea, and find it is not worth the hassle. I mean, why would I want to keep an old Ruby installation, if I have the latest one available and running fine? It will get updated as soon as possible anyway.

I just install whatever the ports tree offers, and that is fine for me.

You made a great choice. Ruby is a great language overall, and is perfectly suited to scripting for application or the web, besides all else. Good luck!


----------



## murias (Jan 24, 2013)

I'm hoping to find out the niceness of the language.

Personally, yeah, I would like to do the ports method.  But on three attempts, I had three fails.  So this time around, I did a bit of research first, and found that the easier way was through rvm.  But that produced, its own problems with linkings etc... Are there any tricks, tips, or techniques you would suggest on using the ports for its installation?

Well, maybe there is an issue already then with my rvm install.  When it installed Ruby, there was a complaint about needing 1.9.3p374 for something, but when I do ruby -v I can swear on anything that it responds with:
ruby 1.9.3p375 (2013-01-18) [i386-freebsd9.1]
Go figure.

Murias


----------



## wblock@ (Jan 24, 2013)

You may have two copies of Ruby installed now, the ports version and the bare source version, with the wrong one being found first in the path.  The nice thing about ports is that it makes upgrading and deinstalling easier.  When you deinstall a port or package, it gets rid of all the files, you don't have to go looking for them.

Something to consider as you gain experience is creating new ports for the software that has not already been ported, or helping to fix ports that don't work like they should.


----------



## UNIXgod (Jan 24, 2013)

Majorix said:
			
		

> Are you sure you installed patchlevel 375? Is that a snapshot or something? Because the latest available over at The Official Ruby Website is p374.
> 
> I have been interested in Ruby for over 6 years now, but only really picked it up in the last few months. However, in none of the machines I used it (FreeBSD, several Linux distros, and even Windows 7) I never tried rvm. I don't really like the idea, and find it is not worth the hassle. I mean, why would I want to keep an old Ruby installation, if I have the latest one available and running fine? It will get updated as soon as possible anyway.
> 
> ...



Rails devs want ROFL-SCALE...

Seriously they don't even think about it. They push their ruby and gem dependencies directly to a jail like environment. There are some sites which depend on older rubies because of how their development model is in a hyper bazaar rapid release stage. Though everything has slowed down. 1.9.3 is compatible with future 2.x later next month.

One thing those developers don't know about is server sided tech. They develop on a mac and deploy to the cloud. Also security is an interesting bit. Since many of these sites are fire and forget style deploys there a probably a ton of "out of money" smoke test startups deployed just waiting to be hacked on a kvm.

None the less. There is a way to get ruby to build in rvm and move it to another location. It would be possible to build though a the bash shim and install for system global removing the need for rvm in the first place. Process would probably go build-jail-in-one-step -> install bash -> install rvm -> build against pushed code's ruby version -> move ruby and gem folder somewhere outside of rvm's pseudo environment -> set up proper environment and install gems from gemspec. remove rvm and deinstall bash.

Oh and automate rofl-security -- sell it as a service in the cloud removing the windowz folks pretending that they are developing sysadmin ops running chef3ngine ---> $$$$

=)

Oh also create a service which automates the process through the cargo cult recipe by installing the thompson hack on sudoku web rack SEO services.

/dev/null


----------



## murias (Jan 24, 2013)

I have moved forth with installing the ports versions.  Seems mostly ok thus far.  I did add a few lines to /etc/make.conf after installing 1.9.3 to ensure ports system knew what version I was working with.

When I installed ruby-gems I got the following:
unable to convert U+00E1 from UTF-8 to US-ASCII for lib/rubygems/package.rb, skipping

It actually gave me about 18 of those errors with different values after rubygems/.  Is this something I should be concerned about?

Cheers
Murias


----------



## UNIXgod (Jan 24, 2013)

murias said:
			
		

> I have moved forth with installing the ports versions.  Seems mostly ok thus far.  I did add a few lines to /etc/make.conf after installing 1.9.3 to ensure ports system knew what version I was working with.
> 
> When I installed ruby-gems I got the following:
> unable to convert U+00E1 from UTF-8 to US-ASCII for lib/rubygems/package.rb, skipping
> ...



You can put this in your .gemrc

```
install: --no-ri --no-rdoc
update: --no-ri --no-rdoc
```

and won't see that error. I have a script somewhere which loads utf-8 everywhere. If I locate it I'll post it.

EDIT:

You used the ports =) Install this port and attempt it again:

converters/ruby-iconv


----------



## murias (Jan 24, 2013)

I had installed converters/runby-inconv before all those errors popped up.

Murias


----------



## UNIXgod (Jan 24, 2013)

murias said:
			
		

> I had installed converters/runby-inconv before all those errors popped up.
> 
> Murias



See here: http://stackoverflow.com/questions/...7-to-utf-8-in-conversion-from-ascii-8bit-to-u

Here's that script had had on that server. There are probably other rc files depending on which programs you use:


```
echo "export LANG=en_US.UTF-8" >> ~/.bashrc
echo "export LC_ALL=en_US.UTF-8" >> ~/.bashrc
echo "export LC_CTYPE=en_US.UTF-8" >> ~/.bashrc
echo "export MM_CHARSET=utf8" >> ~/.bashrc
echo "defencoding utf8" >> ~/.screenrc
echo "encoding utf8 utf8" >> ~/.screenrc
```


----------

