Join Kevin Skoglund for an in-depth discussion in this video Installing Ruby on Windows, part of Ruby Essential Training.
In this movie I am going to help Windows users get everything installed that they are going to need to be able to program in the Ruby Language. Let me start by first giving you an overview of the installation and then I will walk you through it step by step. The first thing I want to show you is the main resource for the Ruby Language, and that's the Ruby Language website, and that's www.ruby-lang.org. You can always go to this website in order to get the latest information about Ruby and to get help with installing. So if any of the installation instructions that I give you coming up in this movie fall out of date, let's say a newer operating system comes out or some kind of incompatibility with a future version of Ruby comes up, this is the first place you will want to go to troubleshoot it, because they will help you figure out what version you ought to be installing with what operating system.
Now let's walk through what we need for installation. There are going to be three pieces. The first is the Ruby interpreter. Remember we talked about that Ruby is an interpreted language, so we will need to install that interpreter. It doesn't come with Windows by default. The easiest way to do that is going to be a one-click installer that's on that ruby-lang site. At the moment if we use that one-click installer, it's going to install Ruby version v1.8.6 for us. Now, there are newer versions of Ruby that are already available. In fact, we are all the way up to 1.9 now. And that one-click installer may be updated in the future to have a different version.
Don't worry about which version it is. Any version is going to work for the things that we are going to do in this tutorial. So go ahead and install whatever version is in that one-click installer and you should be good to go. The second thing we will want to make sure we have available to us is a text editor. Any plain text editor will work for us. What you won't want to do is use something like a word processing program, like Microsoft Word, that includes a lot of formatting information in addition to the text. We want just the text, so that the formatting information doesn't get in the way. Now, the best text editors are going to be ones that offer us code coloring.
That is that they are going to give our syntax, our Ruby Language, different colors to different parts of the language. So that makes it nice and easy for us to see what's happening on the page, because things are broken up by color. There are lot of text editors out there. I am just going to mention two. The first is SciTE, which comes with the Ruby installer. So when we use that one-click installer, we will also get SciTE and we could use that. A third party one that I would recommend is E Text Editor. Its the sister program to the MacroMates' TextMate program, which is on the Mac. It works just the same way. It's a great text editor.
It offers code coloring and everything. I believe it's not very expensive to purchase it, but they also have a trial period, if you want to just download it and try it. The third piece that we are going to need is going to be a command line interface. That's going to allow us to actually interact with Ruby and run our Ruby programs. That comes with Windows. It's inside the Accessories folder and it's called Command Prompt. So we already have that installed and I will show you where that's located. Now let me walk you through the steps. Here I am on the Ruby Language website, and you will see there is a link here for Downloads and there is another one over here that says Download Ruby.
Those take me to the same page. So that will take me over here to the Installation page. You will see it says the current stable version at the moment is 1.9.1. Now, it may change by the time you watch this video, but don't worry about it. What we are interested in is going down here to the Ruby on Windows section, and the one-click installer. So whatever the one-click installer is here with the latest version is what you want to use. 1.8.6 is what it is at the moment. So we will click that. Windows of course will pop-up and say, what do you want to do with this? I will say let's run it. It will just take a moment while it downloads.
Once your file is downloaded, if Microsoft Windows gives you a security warning, you will want to say Yes, it's okay to run this program. We will go ahead and allow the program to run. Now it's hidden, but it's down here in my bar, and there it is. The Wizard has popped up for installing Ruby 1.8.6. I will click Next. I will Agree to the terms of the License Agreements. You will see it's going to install SciTE at the same time. We also have RubyGems and European Keyboard that we can install. If you know that you are going to want to use Ruby on Rails at some point, you would want to go ahead and enable RubyGems as well.
I am going to leave it off for now. Then it's going to install Ruby you can see. So I will hit Next. The Destination, go ahead and take whatever it gives you as a default and we will say Install. And then just sit back and wait while it installs. Once your installation is complete, you will want to click Next. And then click Finish. Now our installation is complete. We can close up Internet Explorer and then we can go to All Programs from the Start menu and what we want to look for here is Accessories and inside Accessories you will find Command Prompt.
You could also do a search for Command Prompt and this will then take you to the Command Prompt. So now we know where that's located. We know how to find that. We should be able to just type ruby-v, and it comes up and tells us, yes, you have Ruby installed and it's version 1.8.6. If we had tried that before the installation, ruby-v, it would have just told us that, sorry, I don't understand that command. I don't have Ruby installed. You remember that the last piece we need is going to be the text editor. So you can download E Text Editor. That's what I have already done here, or I just want to show you where that SciTE program is.
If you go to All Programs and then inside the Ruby folder, where it installed everything, you will find SciTE right here, SciTE. So click on that and now we are inside that SciTE text editor, so that you can go ahead and start typing here, for example. We will talk about what to type and how to get that going. But that's where that application is loaded, if it installed with it. So you have a text editor, but you can also download another one or use something else if you are more comfortable with it. That's all there is to getting things installed with Windows. Now we are ready to start using Ruby.
- Using Ruby in the Interactive Ruby Shell and in standalone scripts
- Learning to write custom code blocks to find, merge, and sort
- Using modules for namespacing or as mix-ins
- Reading from and writing to files
- Creating a full Ruby project from start to finish