tutorial ruby -Install Ruby
Sun Apr 01, 2018 3:58 pm
Install your tools
Ready to embark on the world of happy Ruby coders?
Start by providing you with the basic tools that I will present here to code wonders! :magician:
First things first: the console and the text editor
First of all, you will need to use 2 tools throughout this course:
1st tool: a console (mainly to execute Ruby code)
You have one already installed on your machine, it will be different depending on your OS (Mac, Linux, Windows ...) but the basic commands will be substantially the same.
How to find the console?
On Mac, you can find it in Applications> Utilities> Terminal.
On Windows, tap cmd in the search box and then tap or click "Command Prompt."
On Linux, I invite you to consult these instructions in the Ubuntu documentation to know the procedure according to your version.
2nd tool: A text editor (to write Ruby code)
In this course, I will use Vim, but you can choose any other publisher you prefer!
If you're not familiar with these tools, do not worry, I'm not going to ask you to be an expert: you'll just need some basics to be able to do simple actions with. For that, I invite you to consult the introductions to the console and to the text editor of my course on Git.
And now, let's install the most important tool of this course: Ruby!
Install Ruby
We are going to install the version 2.2.0 of Ruby that we will use in this course.
Note that versions between 2.0.0 and 2.2.0 work properly, and future versions of Ruby are unlikely to radically change the syntax. So if you already have version 2.0.0 or later, it will work just as well!
Mac OS
Check your version of Ruby
It turns out that Ruby is installed base on Mac OS. By cons you may not have the right version. To check the version, launch the "Terminal" application that you can find in the "Utilities" folder of your Applications or by doing a search with spotlight.
[You must be registered and logged in to see this image.]
Once your Terminal is running, type the following command:
Update your version if needed
First, install homebrew , which is a package manager that will allow us to install the rest of our tools. To do this, type in the console:
Then we will use the command brew to install rbenv, a solution to manage multiple versions of Ruby:
brew install rbenv ruby-build
echo 'if which rbenv> / dev / null; then eval "$ (rbenv init -)"; fi '>> ~ / .bashprofile
source ~ / .bashprofile
Finally, you will be able to use rbenv to install version 2.2.0 of Ruby:
Linux
It is possible that Ruby is already installed under your Linux distribution. Verify that you have a version greater than 2.0.0 by running the following command in a console:
If you get an error or version number earlier than 2.0.0, install Ruby version 2.2.0 by following the appropriate procedure for your distribution .
Windows
Go to Ruby Installer to download the latest version of Ruby. The site will provide you with a file .exe , launch it and follow the instructions that will be given to you!
During the installation, remember to check "Add Ruby executables to your PATH" in order to use the Ruby commands in your terminal:
https://i.servimg.com/u/f62/19/80/75/61/ruby310.jpg
Ready to embark on the world of happy Ruby coders?
Start by providing you with the basic tools that I will present here to code wonders! :magician:
First things first: the console and the text editor
First of all, you will need to use 2 tools throughout this course:
1st tool: a console (mainly to execute Ruby code)
You have one already installed on your machine, it will be different depending on your OS (Mac, Linux, Windows ...) but the basic commands will be substantially the same.
How to find the console?
On Mac, you can find it in Applications> Utilities> Terminal.
On Windows, tap cmd in the search box and then tap or click "Command Prompt."
On Linux, I invite you to consult these instructions in the Ubuntu documentation to know the procedure according to your version.
2nd tool: A text editor (to write Ruby code)
In this course, I will use Vim, but you can choose any other publisher you prefer!
If you're not familiar with these tools, do not worry, I'm not going to ask you to be an expert: you'll just need some basics to be able to do simple actions with. For that, I invite you to consult the introductions to the console and to the text editor of my course on Git.
And now, let's install the most important tool of this course: Ruby!
Install Ruby
We are going to install the version 2.2.0 of Ruby that we will use in this course.
Note that versions between 2.0.0 and 2.2.0 work properly, and future versions of Ruby are unlikely to radically change the syntax. So if you already have version 2.0.0 or later, it will work just as well!
Mac OS
Check your version of Ruby
It turns out that Ruby is installed base on Mac OS. By cons you may not have the right version. To check the version, launch the "Terminal" application that you can find in the "Utilities" folder of your Applications or by doing a search with spotlight.
[You must be registered and logged in to see this image.]
Once your Terminal is running, type the following command:
- Code:
ruby -v
Update your version if needed
First, install homebrew , which is a package manager that will allow us to install the rest of our tools. To do this, type in the console:
- Code:
ruby -e "$ (curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Then we will use the command brew to install rbenv, a solution to manage multiple versions of Ruby:
brew install rbenv ruby-build
echo 'if which rbenv> / dev / null; then eval "$ (rbenv init -)"; fi '>> ~ / .bashprofile
source ~ / .bashprofile
Finally, you will be able to use rbenv to install version 2.2.0 of Ruby:
- Code:
rbenv install 2.2.0
rbenv global 2.2.0
- Code:
ruby -v
Linux
It is possible that Ruby is already installed under your Linux distribution. Verify that you have a version greater than 2.0.0 by running the following command in a console:
If you get an error or version number earlier than 2.0.0, install Ruby version 2.2.0 by following the appropriate procedure for your distribution .
Windows
Go to Ruby Installer to download the latest version of Ruby. The site will provide you with a file .exe , launch it and follow the instructions that will be given to you!
During the installation, remember to check "Add Ruby executables to your PATH" in order to use the Ruby commands in your terminal:
https://i.servimg.com/u/f62/19/80/75/61/ruby310.jpg
Permissions in this forum:
You cannot reply to topics in this forum