How to Install Ruby on Rails on a MacBook Pro 2021

This post describes how to install Ruby on Rails on a MacBook Pro.

It’s nice that 2021 MacBook Pros come with the Ruby programming language installed by default. That’s great! There is a problem though because the Ruby version installed by default is 2.6.8, which is just shy of what we need to write a Ruby on Rails v7.0.3.1 application.

To fix this problem, we need to install a more recent version of Ruby on Rails. At the time of writing this, the most recent stable version was Ruby 3.1.0. To do that, I propose that we install a version management software called Ruby Version Manager (RVMOn Github).

In order to install RVM, they say you need to install GPG keys. So I copy the gpg command over to the terminal and we learn that we don’t have the command installed on the new MacBook. Ok, so now we need to find out how to install gpg onto our machine.

To install gpg, I’m going to use a popular package managing software called Homebrew (https://brew.sh/). I followed the Homebrew installation documentation and it worked as it was supposed to.

  • Once we install Homebrew we will be able to install gpg2.
  • Once we install gpg2 we will be able to install RVM.
  • Once we install RVM, we will be able upgrade our Ruby version.
  • Once we upgrade our Ruby version, we will be able to install Rails.
  • Once we install Ruby on Rails, we will accomplish the mission.

When you’re struggling with installing software on the command line, don’t forget to try closing your terminal and reopening it.

Finally, we create a new Ruby on Rails application on the Desktop folder of our application.

With the Ruby on Rails application running via our terminal, we open a web browsing tool (Brave, Google Chrome, Safari, etc.) and navigate to the default port (localhost:3000). Huzzah! We have a Ruby on Rails application running locally.


Ruby on Rails Installation Softwares Used:

  • Terminal
  • Better Snap Tool
  • Ruby
  • Rails

Commands Used for Ruby on Rails Installation on Macbook:

  • ruby -v
  • rails -v
  • sudo gem install rails
  • gpg2 –revc-keys
  • brew help
  • brew install gnupg
  • rvm help
  • rvm install 3.1.0
  • rails new first_m1_rails_app
  • cd first_m1_app
  • rails server

2021 Macbook Pro Details:

  • Operating System: macOS Monterey
  • Machine: MacBook Pro (16-inch, 2021)
  • Chip: Apple M1 Pro
  • Memory: 16 GB

Reset Password Forwarding to Root Domain – Deploying a Ruby on Rails app + Heroku and Devise Gem

Today I solved an error in my Ruby on Rails application.

The problem was that the reset password process led to the root path, rather than the reset password Devise view. This was an error in the production version of the application, which is deployed on Heroku, and NOT on my local development version.

My problem was solved by adjusting the config/environments/production.rb file.

I had this:

config.action_mailer.default_url_options = { host: 'windaily.app' }

Which needed to be set to this:

config.action_mailer.default_url_options = { host: 'https://www.windaily.app' }

This was a bit of a tough one to figure out because I wasn’t getting any error messages. It just didn’t work.

But now the production app is working with the Devise :recoverable setting implemented.