Sunday, May 13, 2012

How do you download/install/run ruby?

Ruby can be downloaded using your favorite package manager. On debian based linux distributions with apt-get, you can simply type sudo apt-get install ruby1.9.1 to get version 1.9.2 or ruby (the naming convention has something to do with library dependencies, which I don't quite understand, but 1.9.2 is the version that gets installed). You can check what version you have with ruby --version.


On Mac OSX with homebrew, its just brew install ruby. Easy!


If you're on windows, you can download RubyInstaller.


You can also compile ruby from source, using the instructions on the download page. Ruby is written in C, and it's open source, so you can view the entire source code on github.


You can run ruby using the ruby command. Ruby source files have the extension .rb, so say you have a file that you've written called helloworld.rb; you can run this using ruby helloworld.rb


You can also start the ruby interpreter using the irb command. After that, you can type any ruby command into the interpreter and it will evaluate it for you in real time, or you can type exit to close the interpreter.


That is how you download, install, and run ruby.

No comments:

Post a Comment