在小牛队上安装Rails

joh*_*doe 23 macos ruby-on-rails osx-mavericks

不知道发生了什么,但当我升级到Mavericks时,它说Rails没有安装.我执行了以下命令:

rails --version
Run Code Online (Sandbox Code Playgroud)

它说"当前没有安装Rails并运行sudo gem install rails".

我运行sudo gem install rails并获得以下内容:

ERROR:  Error installing rails:
    ERROR: Failed to build gem native extension.

    /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/include/ruby.h


Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/json-1.8.1 for inspection.
Run Code Online (Sandbox Code Playgroud)

更新:

我运行命令gcc --version并得到以下内容:

Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include/c++/4.2.1
Apple LLVM version 5.0 (clang-500.2.76) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin13.0.0
Thread model: posix
Run Code Online (Sandbox Code Playgroud)

dep*_*epa 60

您需要安装命令行开发人员工具.只需打开终端并输入需要它的命令 - 例如git,gccmake.或使用以下命令:

$ xcode-select --install
Run Code Online (Sandbox Code Playgroud)

你会看到这样的提醒:

在此输入图像描述

只需单击"安装"即可.从OS X 10.9开始,不再需要为Ruby开发安装Xcode.

相信步骤和图片归功于Daniel Kehoe的最新指南:http://railsapps.github.io/installrubyonrails-mac.html


小智 15

我有同样的问题,我现在能够解决.

对我来说问题是我已经通过appstore更新到最新版本的Xcode,但实际上没有打开应用程序来完成安装.所以这就是为我解决的问题:

  • 更新了Xcode
  • 打开Xcode应用程序
  • 接受的许可协议
  • 安装轨道

希望它也适合你.