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?
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.
我建议您使用此资源来安装Rails及其所需的一切。
Railsinstaller发布了OSX的安装程序,尝试从git存储库https://github.com/railsinstaller下载他们的安装程序(似乎有人破坏了他们的官方网页)。
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!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.