Learn Ruby on Rails Book

Installing Ruby on Rails

Installing Ruby on Rails on Mac OS X

Install rbenv. Using rbenv we can install a specific version of Ruby.

1brew update
2brew install rbenv

If you don't know which shell you are using then refer to this answer.

If you are using zsh shell then use the following command:

1echo 'eval "$(rbenv init -)"' >> ~/.zshrc

If you are using bash shell then execute the following command:

1echo 'eval "$(rbenv init -)"' >> ~/.bashrc

Now restart the terminal and run the following:

1rbenv install 2.7.2
2rbenv rehash

Add ~/.rbenv/bin to your $PATH for accessing the rbenv command-line utility.

If you are using bash shell then execute the following command:

1echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile

If you are using zsh shell then use the following command:

1echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.zshrc

Let's set the default Ruby version for our laptop as the same version we will be using throughout the book:

1rbenv global 2.7.2

In M1 Mac, we need to install the shared mime info, if it doesn't already exist:

1brew install shared-mime-info

Now install Ruby on Rails gem:

1gem install rails --no-document -v 6.0.4

Flag --no-document disables document generation.

Now install bundler which help us manage Ruby gems:

1gem install bundler

Installing Ruby on Rails in other operating systems

At BigBinary we use Mac.

Thus, we won't be documenting on how to install Ruby and Ruby on Rails on Windows/Linux.

There are plenty of good materials on the internet and on YouTube about installing Ruby on Rails and setting up the work environment on Windows/Linux.

TypeError for Rails project in M1 Mac

If you ever receive the TypeError: Unable to resolve type 'size_t' error while working on a Rails project in M1 Mac, then run the following command to fix it:

1bundle update ffi sassc
⌘K
    to navigateEnterto select Escto close
    Previous
    Next