2

I was wondering if you could help me find why I cannot install Ruby on Rails on my MBP with OS X Mountain Lion. It's a weird problem and I'll give you as much info as I can.


I've installed ruby and it's working at version 1.9.3

And I've installed ruby gems and it's worked for every other gem I've tried to install.
It's version is 1.8.24

When I run $ sudo gem install rails it replies with the message: Successfully installed rails-3.2.8 1 gem installed

Although when I ask it rails -v it returns:

`Rails is not currently installed on this system. To get the latest version, simply type:

    $ sudo gem install rails

You can then rerun your "rails" command.`

What should I do?


The rails bash file (/usr/bin/rails) contains:

#!/usr/bin/ruby
# Stub rails command to load rails from Gems or print an error if not installed.
require 'rubygems'

version = ">= 0"
if ARGV.first =~ /^_(.*)_$/ and Gem::Version.correct? $1 then
version = $1
    ARGV.shift
end

begin
    gem 'railties', version or raise
rescue Exception
    puts 'Rails is not currently installed on this system. To get the latest version, simply type:'
    puts
    puts '    $ sudo gem install rails'
    puts
    puts 'You can then rerun your "rails" command.'
    exit 0
end

load Gem.bin_path('railties', 'rails', version)

That must mean that the gem files aren't there or are old or corrupted
How can I check that?

Adam Eberlin
  • 14,005
  • 5
  • 37
  • 49
Jordan Medlock
  • 807
  • 1
  • 8
  • 21
  • I also meet this problem! What is the update? – Li Dong Nov 14 '12 at 08:34
  • I didn't get it to work I reimaged my computer then restarted the whole process and it worked – Jordan Medlock Dec 21 '12 at 16:40
  • I first used JewelryBox as the RVM, but failed to install Rails as your case. Then I found this [page](https://www.wheelhousecms.com/blog/2012/7/installing-ruby-rails-and-mongodb-on-mountain-lion) and followed the instructions, now every thing works. – Li Dong Nov 14 '12 at 10:14

4 Answers4

1

Starting with a fresh install of Mountain Lion...

I tried using,

sudo gem install rails

...straight out of the box. This gave errors summarised by,

ERROR: Failed to build gem native extension.

However, this same command succeeded after I installed the Xcode command line tools via,

Xcode 4.5.2 -> Preferences -> Download -> Components

I made no other changes other than installing the command line tools.

Snips
  • 6,575
  • 7
  • 40
  • 64
0

I recommend you using this resource to install rails and everything you need for it.

zolter
  • 7,070
  • 3
  • 37
  • 51
0

Railsinstaller released a installer for OSX, try to download their installer from the git repository https://github.com/railsinstaller (seems that someone broke their official webpage).

dinnouti
  • 1,707
  • 2
  • 15
  • 21
0

I installed Mountain Lion on my Macbook the other day. I used Homebrew to install RVM (and followed the post-install instructions!), then used RVM to install the latest version of Ruby (1.9.3). From there I set 1.9.3 as the default and then ran gem install rails. So far it has ran without a hitch!

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
Ilya O.
  • 1,500
  • 13
  • 19