Jordan Medlock
Jordan Medlock

Reputation: 817

Installing Rails on Mountain Lion

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?

Upvotes: 2

Views: 1571

Answers (4)

Ilya O.
Ilya O.

Reputation: 1500

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!

Upvotes: 0

Snips
Snips

Reputation: 6773

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.

Upvotes: 1

dinnouti
dinnouti

Reputation: 1796

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).

Upvotes: 0

zolter
zolter

Reputation: 7160

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

Upvotes: 0

Related Questions