This guide and the rest of the book as a whole is going to assume you use Mac or a Debain Linux type of environment (a.k.a. Ubuntu).

Installing Ruby

Installation with Ruby is easier than ever with Mac - it’s already included:

    $ ruby -v
    > ruby 2.4.3p205 (2017-12-14 revision 61247) [x86_64-darwin17]

For this book, I’ll be using Ruby 2.4.3. You’re welcome to use another version if you’d like. There’s not wildly different constructs from version to version. But if you’d like to avoid any potential headaches, please try sticking with 2.4.3.

However, if you don’t have Ruby pre-installed for some freak reason or if you have an older version of Ruby installed you have 2 options:

h4. Installing with your OS Package Manager

For Mac, homebrew is the de facto package manager. Regardless if you want to install Ruby with it specifically I highly recommend using this tool to install developer packages in general.

For Ubuntu, simply run:

    $ sudo apt-get update && apt-get install -y ruby

Installing PHP

This book is tailored for PHP developers trying to learn Ruby. If you don’t know how to install PHP, I suggest that you learn PHP first before embarking on this here quest. No offense.

Ruby Version Managers

Unlike PHP, Ruby is not primarily a Web Language. In PHP, when switching between versions you need to modify your webserver’s path to PHP (mod_enable for Apache and fpm_path for Nginx) and you modify the CLI version of PHP. This is why there are 2 different php.ini files, one is for your CLI PHP configuration and the other is for your Web Server’s configuration of PHP.

Ruby, on the other hand is more global. The same configuration applies to CLI Ruby and Ruby running Rails. It’s the same Ruby.

But there are 2 version managers that allow you to easily switch between versions on your local machine:


rbenv -

Especially if you’re using Docker or a VM to run your Rails environment, this step is unnecessary. But I find it easier to set up a new language locally before trying to emulate it with a Docker Container or VM. This book is going to take that approach.