Sign In | Subscribe
Start learning today, and be successful in your academic & professional career. Start Today!
Loading video...
This is a quick preview of the lesson. For full access, please Log In or Sign up.
For more information, please see full course syllabus of Introduction to Ruby
  • Discussion

  • Study Guides

  • Download Lecture Slides

  • Table of Contents

  • Transcription

  • Related Services

Bookmark and Share
Lecture Comments (10)

1 answer

Last reply by: Professor Mui
Wed Mar 12, 2014 12:28 AM

Post by Abdallah Alqassabi on March 7, 2014

I am new to programming, but there is something that i did not understand at the very beginning for sitting up the program. I did not get the part one you go to brew and copy some stuff and you past them somewhere that i don't know, as well as the RVM and stuff. Could you please explain what are they ? and what are the things specifically that i need to download. I am using Mac OS X. Please help !

0 answers

Post by Professor Mui on August 14, 2013

Yes, Ruby 2.0.0 is the latest version.  You can use that one and still continue through the lessons!

0 answers

Post by Kelvin Tjia on August 13, 2013

please keep in mind that this was recorded in the past and in the future there may have been changes.

Do i download the Ruby 1.9.3? The top one on the list is now Ruby 2.0.0.

I am new to programming.


1 answer

Last reply by: Professor Mui
Tue Jun 11, 2013 10:39 AM

Post by Caleb Lear on June 6, 2013

I wonder if you might include the links in the Quick Notes so we can just copy and paste them?

1 answer

Last reply by: Professor Mui
Wed Mar 6, 2013 9:37 PM

Post by Jonathan Aguero on March 6, 2013

how do I become the user/owner for ruby doesn't let me I have a hp windows 8 laptop what can I use as the code as the user

1 answer

Last reply by: Professor Mui
Wed Feb 13, 2013 1:15 AM

Post by marvin evins on February 12, 2013

how do you get to your bash profile on 14:55? Is it cd/.bash profile?

Setting Up Your Environment

  • This lesson gives you an introduction to ruby through its history starting from its creation and its spreading from the eastern world to the western world.
  • Ruby is a dynamic and expression programming language that is elegant and flexible
  • Ruby was created by Yukihero Matsumoto. He wanted to design a programming that that would "make programmers happy."
  • You can follow
  • Ruby was popular in Japan but grew popular in the west around 2000 when the first English book "Programming Ruby" was printed
  • The book can be seen online at:
  • The first English mailing list Ruby-talk and other Ruby mailing lists can be found at:
  • You can also subscribe to Ruby-talk through email at:
  • Ruby popularity skyrocketed with interest in Ruby on Rails (
  • Ruby is an interpreted language, scripting language, and also suitable for procedural and functional programming.
  • Every value in ruby is an object.

Setting Up Your Environment

Lecture Slides are screen-captured images of important points in the lecture. Students can download and print out these lecture slide images to do practice problems as well as take notes while watching the lecture.

  • Intro 0:00
  • Installing Ruby 0:06
    • Three Ways of Installing Ruby
    • Compiling Ruby-Source Code
    • Third Party Tools
    • Other Implementations of Ruby
  • Windows Installation 5:21
  • Mac OSX and Linux Installation 6:13
    • Mac OSX and Linux Installation
  • Setting Up Debian/Linux 6:42
    • Setting Up Debian/Linux
  • Installing HomeBrew 6:56
    • HomeBrew for MAC OSX
    • HomeBrew Wiki
    • Installing HomeBrew
  • Setting Up Mac OSX 11:46
    • HomeBrew, RVM, OSX-GCC Installer, and Install Ruby 1.9.3
  • Ruby Version Manager (RVM) 12:11
    • Ruby Version Manager (RVM) Overview
    • Installing Ruby Version Manager (RVM):
  • Install RVM with Ruby 14:20
    • Install RVM with Ruby
  • Install OSX-GCC-Installer 16:18
    • Download and Install Package for Your OSX
  • Install Ruby 1.9.3 17:28
    • Install Ruby 1.9.3
  • Test It Out! 18:09
    • rvm-help & ruby-v
    • Example: rvm gemset create educator
  • Set It As Default! 20:47
    • rvm Use 1.9.3@educator--default

Transcription: Setting Up Your Environment

Welcome back to Today's lesson is on setting up your environment.0000

The goal of this lesson is to get your environment set up so you are using the same Ruby version as us, and you have everything in sync, so you have the same tools I'm using.0006

The first thing we are going to look at is

This has the core Ruby code--source code--and we are going to be using 1.9.3 for all of our lessons.0032

If you are on a Mac, you might see 1.8.7 set up by default, but you should go through the steps in this lesson to get you set up with 1.9.3 so you don't see any issues as you are developing.0049

First, let's go to that website,, and check it out.0066

If you go here, at, you will notice that it has a lot of documentation information, about it.0071

It will give you a little gist of what Ruby is, and it will show you some code for a class.0085

What they do here, is they give you a lot of versions... from latest to oldest. 0096

So you will see that it says "1.9.3-p27 is released."0101

That's the latest one. And you can go here and see the change log, and see what bugs have been fixed. 0107

Go ahead and click the change log; you will see that they give you a whole list of things that have been fixed for this version.0119

You can go ahead and check it out if you want, but I think mostly you just want to get the most stable one, so I'll show you how to do that.0126

The main thing see all this news...the main thing here is this "Download Ruby" button.0134

So, you click "Download Ruby," and it will tell you that the stable version is 1.9.3, and it will tell you three ways of installing Ruby.0144

Going through these ways: one is compiling it from source, another is using a third-party tool to install Ruby--and we are going to go through each of these-- and using a package management system.0156

One third-party uses RVM.0174

We're going to go over that. So, first, compiling Ruby by source:0179

You can just download this link here; that will give you the latest one.0187

It's tar and gzip. So, you know how to install source...0191

Go ahead and download and compile it.0195

But we are going to go through setting up RVM, so you might want to take a look at that before you just build from source. 0201

That is the next one: they say here, "Use a third-party tool."0208

This RVM is very popular. It's called Ruby Version Manager, and it makes it so installing Ruby is easy.0211

Plus, developing it is easy, because I can use multiple versions of Ruby as I'm developing.0222

It is available for Mac OS, Linux, or any UNIX operating system.0226

Windows does have a version, pik, that does a similar thing.0232

It's very easy to install: use this curl command...0237

And then there is RubyInstaller: that is for Windows, to install the Ruby version on Windows.0244

And then they have packages: Linux--you can use "apt-get" to install it, and also there is a package called pacman for Arch Linux system;0253

Mac OS X--you can do "brew install ruby"--0269

Brew is also another package--0274

Then if you are looking at Solaris or OpenIndiana, you can use this "pkg install runtime/ruby-18".0278

There are also other implementations of Ruby.0288

We are not going to get into those, but it's good to know that you have them there.0291

You have JRuby for a Java Virtual Machine, MacRuby to run Mac OS code, IronRuby for .NET.0298

So, that is for you.0310

Mostly, you build it from source; that's what you use for it; but we are going to go a different route.0314

Let's go ahead and click RubyInstaller, for you Windows folks; they make it really easy for you. 0321

I'm at, and they have a 1.8.7 version and a 1.9.3. You are going to get the 1.9.3 version.0333

Click on the "Download" button--just choose this top one--0338

It's executable. You download it; you get an executor; you double-click; you install it.0343

It will get you all set up with Ruby. 0348

You also have a lot of information here about documentation for it.0353

You can go to this "help" button, and it has a whole wiki of information to help you set it up, as well, if you have issues.0359

Double-click, you're set up, ready to go.0368

And Mac OS X and Linux installation--we already saw it--0373

You go to ruby-lang; you can install it through source, install it through the package management system.0379

But we are going to do it differently. We are going to install it using a combination of Brew and RVM.0385

So, this is my recommended route; we are going to use Brew and RVM to do that.0392

I'm setting it up with a Debian Linux.0402

You can just use "sudo apt-get install ruby 1.9.3", and it will get your version set up for that.0408

And so, we are going to deep-dive right into doing it with Homebrew.0413

Now we have it for a Debian; we have it set up for Windows.0423

Now we are going to structure it for the Mac OS X. A lot of my lessons will be in the Mac OS platform,0428

So let's see if we can get you to mimic the same behavior on your setup right now.0436

The first thing that we want to do is install Homebrew on your Mac machine.0441

Just go to this link over here, and what we are first going to do is install Brew--0447

It's a one-line command, and then we want to run Brew Update, and then you want to install a library. 0456

Type "brew install libksba"0465

Actually, let me remind you that this library here--0468

You probably want to take notes on this, too, but--0474

This one is required because you are installing Ruby

This is required...for Ruby 1.9.30483

What Brew Update is going to do is update Brew and make sure it's on the latest system file.0495

So, you want to run that next, after you install Brew.0502

Let's go ahead and look at the browser to see that.0507

So I'm going to go up here, and I'm just going...let me zoom it in a little bit deeper...0513

But Homebrew is a package management system on OS X.0519

They make it really easy to install things.0524

If I want to install wget, I just use Brew install wget.0529

I don't have to worry about getting it from the source--it's going to handle that for me.0532

It installs these packages in their own directories, links them up for me, does a lot of the rough work.0535

You will notice there is a lot of information documentation to help you get along, but what I want you to do is just go way to the bottom of this page.0548

And look at the main "Install Ruby"; that is the main one we're talking about doing.0558

So, you have this command here...0563

Run that, and you will get Homebrew set up on your machine.0568

Because it does say Ruby on it, there are further instructions if you don't have Ruby already set up to do it.0574

Go to Homebrew wiki, and it will show you some other methods to install it.0584

Because, most likely, you are already on 1.8.7, but we're upgrading to

So what you will do is...because, when I run ruby -e, you will see...I'm already on

But what I did is first, some hints for just installing Brew, if I just run Brew, you can already see your setup. 0615

You have some examples of usage like this, when you run the brew command.0627

I'm not sure if there is a version. Let me run --brew...there is a version. So I'm running

But, when I install it, I copied that command from that page, I paste it here, and I just press Return. 0635

And it's going to fetch this Homebrew and it's going to execute it. And that is going to install it for you.0642

But since it's already set up, I'm not going to do that, but I'm just commenting about that.0651

That's it. Just run that command, press Return, and it will install it for you.0656

If I even ran it now, it's going to start doing some things, downloading it, but I'm going to cancel that, but that's it.0661

You will notice you have your "Install Homebrew": you are going to click here; it gives you some information; install it...0672

But really, that one-liner is all you need.0686

And remember, after you get that Homebrew installed, run Brew Update and Brew Install...this libksba library.0690

That is important so we can move you up to

OK, so we talked about Homebrew.0707

Next on our list, we need to install RVM.0712

And then we are going to look at OS X GCC installer,0717

and then installing Ruby

There is quite a little bit of things we have to do to get you up to that version.0726

Ruby Version Manager--that is what RVM is. That is the acronym.0732

This is a command-line tool that allows you to install, manage, and work with multiple Ruby environments.0738

Ruby environments/Ruby versions. It's a very nice tool.0746

It allows you to...let you be able to run Ruby 1.8 and Ruby 1.9 concurrently.0750

So, let's go ahead and look at the page. We're going to go to

I already have the browser set up. On the page, they have this...there you go. I lost my browser for a moment.0767

This is Ruby Version Manager. You get a nice splash page.0780

As you go down, you will notice "visit the installation documentation."0784

They have screencasts, so you can look at screencasts and see videos.0790

And, they have some things about Rails, too.0794

First, I want you to just look at the introduction.0799

They will give you a little spiel about what it does, and then what we want to do is just install it. That's the main thing.0804

They have a lot of great documentation here, but let's just get right into installing this.0812

Let's click...when you click the installation document, you will see "Installing RVM,"0818

and they give you a quickguide. Again, it's just like Brew; it's just a one-liner.0828

You have a curl command; you can just copy that, paste that in your terminal, and get you set up, on your way0832

Again, here is that command, right there. If you just run that in your terminal, press Return, let it will take a little bit of time...0864

After that is set up, you have to update your .bash profile.0870

So in your relative directory--.bash profile-- you need to include this line--it's all one line.0875

And what this line will do is make sure that RVM is loaded when you open your terminal.0883

It loads RVM, which is very important for us.0896

If...I have my terminal here, all I have to do is run this command, press Return--it's going to install RVM.0903

Again, it's already installed on my machine, but if I did RVM --version,0912

You will notice it's RVM

So after you do that, let's go to my .bash profile.0928

I've already added that line, so if I go to relative path, and just do run-profile, and I press Return--this is where you would paste that command from that slide-- and all this does it to get RVM set up on your machine.0934

It runs source, so make sure it's loaded up on that terminal.0955

Then, you can go ahead and run RVM. You will see a lot of usage information there, and a lot of different things you can do with RVM here.0960

Now that we have RVM set up, we have Brew installed, and now we need to set up this OS X GCC installer.0980

This, again, is something we need for Ruby

So you need to go to this link, and you just download the file there. Double-click; install it to your Mac OS machine.0994

And it's going to be set up, installing.1004

I go to the link want to choose the latest one...10.7-v2. 1009

But you can also see, that's for OS X versions 10.7 and up1015

If you are going to download to OS X 10.6, then choose the one right below that.1023

Download it to your machine, double-click, and it will install it from there.1030

That will install the OS X GCC installer.1036

So you are almost complete--we almost have it set up. We just need to get 193 going now.1043

And now it's very easy. All you have to do is run this Ruby...install...

And that should get it going--very easy. In your terminal, RVM install 1.9.3,1057

Return, let it load up. If you are on an older Mac OS version--if you are on Snow Leopard--1063

You might have to, if you have any issues, do RVM reinstall 1.9.3, with GCC Clang.1068

That should resolve any issues; there are some common bugs with Snow Leopard, so just run that and try it out. After that, just run ruby-re;1080

If you see that Ruby 1.9.3, you're set.1091

You can also run RVM-help; they have a lot of usage information to see commands you are going to do with RVM, because what they do in RVM is you run RVM, and then you can run options.1096

In these options, you can run different things.1112

The next thing we're going to do after this is create a Gemset.1118

That is one of the options there.1122

You can actually change the Ruby version, too.1127

OK. Now we are set up. We have RVM going.1131

The next thing I want to do is set up this Gemset.1136

What this does is to encapsulate all the different Gems I have-- all my different plugins-into one area.1140

This area--we're going to call it Educator. Let me show you that, too, now.1150

RVM, Gemset, Create, Educator.1155

You see, when I press Return, it says "Educator Gemset Created." 1161

And later on, I can just use "RVM, Use Gemset, Educator," and it will go back to it.1167 looks like something...I think I have to use "RVM, Gemset, Educator,"1174

Yes, "RVM, Gemset, Use Educator."1190

But what this does is, if I do Gem List, 1195

There is a list of Gems here, and when I create a new Gemset, it will have a different list.1200

So, let's do "RVM, Gemset, Create, Educator 2," and I'll do "RVM, Gemset, Use Educator 2,"1207

You will notice that if I do Gem List, I will have a different set from if I do "RVM, Gemset, Use Educator 1."1218

They are both different containers with their own gems in them.1226

OK, run that, test it out--run RVM, the Ruby version, and you should have your Ruby set up, your RVM set up; you have your Ruby 1.9.3;1235

You have a Gemset created, as well; and all you do is set that as default.1245

When RVM...Use 1.9.3 at Educator,1252

So, what this does is it sets up your Gemset...1257

It sets up Ruby 1.9.3, and then it defaults it--makes this your default environment whenever you are developing.1268

The reason those's --flak.1290

And there you go! You have RVM set up, now you have your environment set up, and now we can get to some cool things in Ruby--1294

Start doing some development...we have the latest Ruby version going...1300

You're getting happy, learning about Ruby, and you are getting really ingrained into it, so it's nice.1306

That is the end of this lesson, and I hope you enjoyed it and will go on with me into the next lesson.1314

There we will go on to deeper functionality in Ruby and start getting closer to doing some code.1323