在小牛队上安装Rails

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

rails --version 

它说“当前没有安装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. 

更新:

我运行命令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 

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

 $ xcode-select --install 

你会看到这样的提醒:

在此处输入图像描述

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

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

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

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

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

希望它也适合你。

即使我重新安装xcode和mavericks的命令行工具,它也不适用于我。

但在那之后,我刚刚进行了bundle update并且由于某种原因,它有效。

我想我有同样的问题。 我更新了xcode并打开xcode以接受许可证聚合。 然后,就我记忆中的情况而言,它运作良好。