Ruby On Rails For Mac Os

I have downloaded Lion and looking to install Ruby on Rails I have been scanning the web for a way to do this but can't seem to find a easy way, could anyone point me in the correct direction. I recommend you develop on OSX and deploy to Linux. First, Rails relies heavily on console commands. These are Unix-based. And since OSX is a sleek GUI for Unix, it's a perfect fit. These commands are just more 'comfortable'. 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. There are plenty of people who have documented solutions for them. This will take about 30 minutes. We will be setting up a Ruby on Rails development environment on Mac OS X 10.11 El Capitan. 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. 1 In your browser, go to Atom Installer and click the Download for Mac button. Atom is a free, powerful code editor that can be used for programming many different computer languages. It works well with Ruby. Depending on the settings of your browser, the Atom download archive may automatically uncompress or a zip file may be placed in your Downloads folder.

Ruby On Rails For Mac Os Catalina

This article explains why you should avoid using the version of Ruby bundled with Mac OS X and should instead install your own version of Ruby with RVM, the Ruby Version Manager.

Hands Off the System Ruby

Ruby on rails for mac os catalina

Apple bundles the Ruby programming language with OS X. However, the main caveat for using the bundled version, called the system Ruby, is that Apple bundles Ruby for it’s own use. Therefore, it’s best not to make changes to the system Ruby.

You’ll know when you’re about to change the system Ruby when you need to prefix a gem installation with sudo, for example:

Another reason for not using the system Ruby is that it’s often several versions behind the latest stable version.

The Ruby Version Manager

A better alternative to using the system Ruby is to install Ruby with RVM, the Ruby Version Manager. RVM is a tool for installing different versions of Ruby itself. RVM has the following advantages:

  1. RVM enables you to install multiple versions of Ruby and allows you to change which version you want to use.
  2. RVM installs each version of Ruby in a hidden folder in your home folder so each version of Ruby you install doesn’t affect the system Ruby.
  3. Gems installed by RVM-managed versions of Ruby are installed within the hidden folder in your home folder containing that version of Ruby.
  4. You won’t need use sudo to install gems.

To check that you’re currently using the system Ruby, open Terminal and type the following:

If you’re using the system Ruby, OS X will respond with:

You can check which version of Ruby OS X is using with:

Installing RVM and Ruby

The RVM install page has comprehensive instructions for installing RVM that work on Mac OS X. I’ll provide the steps I used here.

The first step is to install the mpapis public key. However, as the install page notes, you might need gpg. Mac OS X doesn’t ship with gpg so before installing the public key, you’ll need to install gpg. I installed gpg with Homebrew:

After you’ve installed gpg, you can install the mpapis public key:

I've listed the mapis public key install command here for illustration. You should use the version on the RVM install page.

I chose to install RVM with the latest stable version of Ruby, which at the time was 2.2.0:

After the installation completes, close the Terminal window and open a new one to make sure that Terminal picks up any environment changes.

Using RVM

You can list the versions of Ruby available to RVM with rvm list:

The rvm use command selects a version of Ruby:

You can check that you’re using an RVM-managed version of Ruby with:

OS X now responds with:

which tells us we’re using version 2.2.0 and that version 2.2.0 has been installed in my home folder away from the system Ruby. You can confirm this by asking Ruby itself with:

Mac

The RVM-managed version of Ruby responds with:

As I mentioned earlier, gems installed with RVM-managed versions of Ruby are located with the Ruby. You can check where gems will be installed with:

The following lines of output shows that gems will be installed in the folder XXX.

Mac

To find out where a particular gem is installed, use the gem which command. For example, gem which jekyll locates the Jekyll gem:

Mac OS X Ruby on Rails


© May 2019 Anthony Lawrence

Ruby On Rails For Mac Osx

I've been ignoring Ruby on Rails for a while now. Oh, I knew I'd have to look at it sooner or later, but you know the old saying about old dogs and new tricks. You may have also seen a dog or two being dragged across a floor when they didn't want to go somewhere; that's pretty much the image you should have of me and Ruby on Rails.

The July 2006 issue of Linux Journal has been kicking around the edges of my desk for a few days. Part of the reason I had been pushing it aside is that the cover theme is Ruby, Ruby, Ruby. 'Fahh, fahh, fahh', I grumbled to myself as I once again moved this issue somewhere where it couldn't stare at me with that accusatory 'you haven't even OPENED me' look.

Last night, sometime after we had eaten dinner and before settling on the porch with a Corona, I picked up the magazine and started thumbing through it. I read the letters, perused 'diff -u', skipped 'At the Forge' and 'Cooking with Linux', and then thumbed to Reuven Lerner's 'Introduction to Ruby'.I probably made a face as I started reading, but then..

Hey, this isn't so bad. Mac OS X 10.4 has ruby and irb (interactive ruby) installed by default, so I was able to just type 'irb' and follow along with the examples. Hmm.. I'm starting to like this 'ruby' thing. Suddenly I don't feel like I'm being dragged across the floor trying to dig my nails into linoleum. No, this dog likes Ruby! Give me more!

So what the heck: let's go for the Rails! I found hivelogic.com/articles/2005/12/01/ruby_rails_lighttpd_mysql_tiger(link dead, sorry)Building Ruby, Rails, LightTPD, and MySQL on Tiger, which is an excellent guide to getting this all installed. One minor glitch: I had some trouble with Ruby Gems. Unfortunately,I'm not sure what finally got it working, but ultimately it started behaving. I tried installing it manually, but couldn't get by a 'No such file to load -- rubygems (LoadError)'.The Hivelogic docs mention that and say it's a PATH problem, but that wasn't the case for me. I did some web searching and found that Ruby can be quite confused as to what the real problem is when it gives this error, but I still couldn't nail it down. Because I was multitasking while investigating this, I had gone ahead and installed MySQL; strangely it seems that Gems started working after that.. I can't imagine why.

Ruby On Rails For Mac Os

Anyway, the final step was to have Rails create a skeleton app. I did 'rails try_rails; cd try_rails; ruby script/server' and then pointed Firefox at https://localhost:3000 - and there it was, Ruby on Rails up and running and ready for me to use.

Well, it's ready. I'm not. I have quite a bit more reading and futzing about to do before I can do anything useful or fun.But at least it's all installed, and I have a reason to read more of this month's Linux Journal.

See Mac OS X Ruby on Rails II also.


Got something to add? Send me email.

Install Ruby On Rails Macos High Sierra


(OLDER) <- More Stuff -> (NEWER) (NEWEST)
Printer Friendly Version
-> -> Mac OS X Ruby on Rails

Download Ruby On Rails

Ruby on rails mac os

Inexpensive and informative Apple related e-books:
Take Control of OS X Server
Take Control of the Mac Command Line with Terminal, Second Edition
El Capitan: A Take Control Crash Course
Take Control of Pages
Take Control of IOS 11