This will take about 30 minutes. We will be setting up a Ruby on Rails development environment on macOS 10.14 Mojave. Older versions of OS X are mostly compatible so follow along as far as you can and then Google search for any problems you run into. I am reading the book Programming Ruby and am looking to upgrade the version of Ruby on my computer. I run Mac OS X Snow Leopard and doing ruby -v in the command line shows I am running Ruby 1.8.7. I installed MacPorts and ran the sudo port install ruby19 command but whenever I type ruby -v, it still shows Ruby 1.8.7.
Available for: Mac OS X v10.6.8 and later. Impact: Multiple vulnerabilities in Ruby. Description: Multiple vulnerabilities existed in Ruby versions prior to 2.0.0p645. These were addressed by updating Ruby to version 2.0.0p645. Upgrade Your System to OS X Mavericks. Installing Ruby on Rails is simple, but unless you have an.
I previously posted about how to upgrade your ruby environment for OS X Mavericks: https://coderwall.com/p/5awmcq. I was helping a friend update his environment using the same steps, but we kept running into issues building gems with native extensions.
This was apparently due to a conflict between RVM (ruby version manager) and the installed version of GCC.
After a lot of dead ends attempting to get the gem bundle to install, I eventually stumbled on this SO question: http://stackoverflow.com/questions/15204141/adding-usr-bin-gcc-4-2-to-path-installing-ruby.
![Ruby Ruby](/uploads/1/1/9/7/119773673/698216580.jpg)
The only answer (at time of writing) was to run:
This spills out a ton of useful information about the rvm config. In the case of the machine I was working on, there were a variety of things missing for rvm to successfully install ruby and compile gems.
First I removed the existing version of ruby:
Then followed the detailed instructions returned by running
rvm requirements
. In my case:Reopen your terminal windows. Then install gcc-4.2:
Further information: http://stackoverflow.com/questions/8032824/cant-install-ruby-under-lion-with-rvm-gcc-issues
After running these steps, ruby was installed cleanly and bundler was able to install gems with native extensions. There are many questions on SO and various fixes recommended, but these were the steps that worked for me.
Install Command Line Tools
To install the command line tools to compile native extensions, open a terminal and run:
Install Ruby
Jekyll requires Ruby v2.5.0 or higher.macOS Catalina 10.15 ships with Ruby 2.6.3. Check your Ruby version using
ruby -v
.If you’re running a previous version of macOS, you’ll have to install a newer version of Ruby.
With Homebrew
To run the latest Ruby version you need to install it through Homebrew.
Add the brew ruby path to your shell configuration:
Relaunch your terminal and check your Ruby setup:
You’re now running the current stable version of Ruby!
With rbenv
People often use rbenv to manage multipleRuby versions. This is very useful when you need to be able to run a given Ruby version on a project.
Restart your terminal to apply your changes.Next, you can install the Ruby version you want. Let’s install the latest stable version:
Ruby For Mac Os X 10.8
That’s it! Head over to rbenv command references to learn how to use different versions of Ruby in your projects.
![For For](/uploads/1/1/9/7/119773673/808774245.png)
Install Jekyll
After installing Ruby, install Jekyll and Bundler.
Local Install
Ruby For Mac Os X 10.6
Install the bundler and jekyll gems:
Get your Ruby version:
Append your path file with the following, replacing the
X.X
with the first two digits of your Ruby version:Check that
GEM PATHS:
points to your home directory:Every time you update Ruby to a version in which the first two digits change, update your path to match.
Global Install
We recommend not installing Ruby gems globally to avoid file permissions problems and using
sudo
.On Mojave (10.14)
Because of SIP Protections in Mojave, run:
Before Mojave (<10.14)
Run:
Troubleshooting
See Troubleshooting or ask for help on our forum.