我在 Mac 上使用 Ruby on Rails 时遇到问题。它可能与我的 xCode 或 OS X 1.8.4 版本有关。我这样说是因为我过去能够创建 Ruby on Rails 应用程序。
这是我的问题。当我运行rails new rubyDemo
创建一个新的 Rails 应用程序时,我收到以下错误:
create
create README.rdoc
create Rakefile
create config.ru
...
...
Using execjs (2.0.1)
Using coffee-script (2.2.0)
Using rack-ssl (1.3.3)
Installing json (1.8.0) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ruby.h
Gem files will remain installed in /Users/tithos/.bundler/tmp/9865/gems/json-1.8.0 for inspection.
Results logged to /Users/tithos/.bundler/tmp/9865/gems/json- 1.8.0/ext/json/ext/generator/gem_make.out
An error occured while installing json (1.8.0), and Bundler cannot continue.
当我尝试跑步时sudo gem install json -v '1.8.0'
我收到以下错误:
Building native extensions. This could take a while...
ERROR: Error installing json:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ruby.h
Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/json-1.8.0 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/json-1.8.0/ext/json/ext/generator/gem_make.out
我在跑步:
ruby -v
ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin12.0]
rails -v
Rails 3.2.13
我不知道我还缺少什么其他宝石和/或碎片。
任何帮助都会很棒
PS对不起,很长的帖子