Learn to Code Special! | 30% off ALL ACCESS to One Month ๐ŸŽ‰๐ŸŽ‰๐ŸŽ‰

Hide

Setting up Ruby

Week 1: Introduction to Ruby ยท Lesson 5 ยท


Let's get Ruby set up on your computer.

Resources:

Edit: If you have trouble with the steps in this video, you may find it easier to install Ruby by following along with the steps at InstallRails.com. Follow the step by step instructions for getting Ruby, Homebrew, RVM, Git and even Rails (though it won't be necessary for this class).

- Alright so I said you only need your terminal
and your text editor
to get started with this course.
Actually you also need to install Ruby.
So I'll talk about what
that means in a second.
If you're on a Mac,
you probably already have Ruby
installed on your computer
and you don't know it.
If you're on a Windows you probably don't.
That's okay we're gonna install it anyway
because on a Mac you probably have an old version
of Ruby that comes shipped with your computer
and it's not updated
and we wanna use the newest thing.
Programming languages believe it or not
actually evolve over time.
You can confirm whether or not you have it
by going into your terminal or your command line,
I'm gonna probably use the two terms interchangeably
so bear with me,
and type in ruby
all lowercase with a space
and then a minus
and a V.
What this stands for is Ruby,
space, minus version.
You could type that
and it actually tells you a bunch of stuff
like right here it says Ruby
2.0.0P645
2.0.0P645
2.0.0P645
2.0.0P645
and then a bunch of stuff here
and a bunch of stuff here.
Honestly I don't even know what this means
so don't worry about it.
One of the important things
that you're gonna end up learning
and getting more confidence in is
knowing where to look
and what to pay attention to
like this stuff
and even honestly just this last part
without the P this means Patch
Like it's a version of a Patch.
And which stuff you can ignore like
all of this stuff.
This may be useful for some people
but I don't know,
I don't worry about it.
So
this is
Version 2.0.0
Version 2.0.0
Version 2.0.0
You probably have a different version
on your computer,
if you have a Mac you might have like 1.8.7
or 1.9.7.
If you're on a Windows you don't have anything.
What I'm gonna show you how to do is
install the latest version of Ruby.
Now also
note that I just taught you your first command.
This command basically is
tell me what version of Ruby
I have installed on my computer.
So OK what are the steps here?
Well if you're on a Windows it's pretty easy,
just look for Ruby installer
and what you'll find is
rubyinstaller.org
and it's a pretty simple download,
you can download
all different versions of Ruby.
I'd recommend just going for the latest one.
2.3.0
2.3.0
I guess they have a different one
for x64 which is a different kind
of like CPU
I believe.
Just try downloading the first one,
see if it works.
You may have to download the second one
if that doesn't work
or you can do some research into
what kind of a
what kind of CPU you actually have
and then just download that one properly.
I'm not sure honestly happens
if you fuck this up
so that's something to find out about.
If you're on a Mac,
things are gonna be a little bit trickier
but the preferred way to install Ruby on a Mac
is to use something called RVM.
Which stands for Ruby Version Manager.
What this actually allows you
to do is have multiple versions of Ruby
on your computer.
Now why would you want to do this?
It's not really that useful until
kind of later on as a developer.
If you're working on multiple projects
and you kind of need different versions
of Ruby for different projects,
this kind of lets you
put each of these versions in a different place
so you can switch between them.
It also makes it easier for you
to install new versions of Ruby
and stuff like that.
But it happens to also be the easiest way
to get a new version of Ruby.
So
OK
installing RVM
here we go, look this up
look up the site.
What you have here is it actually is telling you
to enter these commands here in the terminal.
The first dollar sign thing
you don't have to enter
because it actually starts
with a dollar sign here you'll notice
and so what it's telling you here
is the name of the computer,
this actually says what folder you're in,
that's called Atilda
and it stands for something
but you don't have to worry about that for now
and then this is your username
and this dollar sign
you might have something
totally different before this dollar sign
you probably do
but after that
you can type in this stuff
or copy it, I wouldn't actually type
all this stuff in cause it's crazy long.
So let's
type that put it in, hit enter
OK
you need GPG,
don't have that yet.
Let's see if I actually do need that.
I'm gonna just paste the second part,
download it,
and
it works just fine great.
[Chuckling]
It says no GPG software exists to validate it.
I'll tell you what the GPG software stuff
actually means.
It's like a private key system
for you validate
like whether this is the right version
that you're getting
and to make it more secure
but it looks like it just skips it.
A lot of stuff just happened for you,
what it says I guess I'll go through briefly,
downloading this file,
see downloading https blah blah blah
downloading something,
found PGP signature
but no PGP software exists to validate it,
skipping, installing,
there's a lot of stuff here
and I usually don't read most of it
but it looks like everything
succeeded just fine.
Let's see how do we know if everything succeeded?
Well
Hopefully somewhere on this site
it actually tells you,
what to do.
Let's see if just typing in RVM should work
or maybe Command+T,
I just opened up a new tab with Command+T
or you can go to the Shell and new tab.
Does it work here?
Yup.
So a lot of times
what you'll find in the Command line
is if you install something
then you might have to like open up
the Command line again
for the installation to actually take effect.
This is something you kind
of get used to doing after a while
and yeah it's one of those things
that you wouldn't really know to do unless
you figure it out the first time.
So close this guy again.
Now we have RVM.
Now let's look up
install Ruby with RVM.
Cause obviously I haven't memorized
all this stuff off the top
of my head.
RVM.
This top one,
nope not doing that part.
Installed this,
already did all that stuff OK.
Where is the actual installation
of Ruby?
OK try out your new RVM installation,
How to use a Ruby under RVM.
You can type RVM list known
and that tells you all the different versions
of Ruby
that it knows about, OK
I don't know what most of these are
but it works
and then install a version of Ruby.
I'm gonna go ahead and install
the most recent version of Ruby.
Let's actually see if I can find that in here.
Ruby 2,
no...
RVM list
OK so there's nothing installed yet.
I actually believe that there's
Ruby like
2.3
so let's just try RVM install 2.3.
You're gonna run into a lot of problems
when you try to work with this stuff
and can be really frustrating,
I know,
because we don't even have Ruby installed yet.
This probably gets
to our first lesson on debugging.
So in the next lesson I'm gonna tell you how
to debug something like this.
If you're a Windows user
and you're not following along with this,
don't worry I still highly recommend
watching the video,
so you can see the steps
that I would take
to solve this problem.