【问题标题】:rails install: xcrun: Error: failed to exec real xcrunrails install: xcrun: Error: failed to exec real xcrun
【发布时间】:2012-12-23 08:57:27
【问题描述】:

我正在尝试使用教程:http://ruby.railstutorial.org/ruby-on-rails-tutorial-book?version=3.2#sec-install_ruby

当我执行sudo gem install rails -v 3.2.9 时,我收到此错误:

Building native extensions.  This could take a while... ERROR:  Error installing rails:   ERROR: Failed to build gem native extension.

    /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
extconf.rb creating Makefile

make xcrun cc -I.
-I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin12.0
-I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin12.0
-I. -DJSON_GENERATOR  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE   -fno-common -arch i386 -arch x86_64 -g -O3 -pipe -fno-common -DENABLE_DTRACE  -fno-common  -pipe -fno-common   -c generator.c xcrun: Error: failed to exec real xcrun. (No such file or directory) cc -arch i386 -arch
x86_64 -pipe -bundle -undefined dynamic_lookup -o generator.bundle
generator.o -L.
-L/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib -L. -arch i386 -arch x86_64     -lruby  -lpthread -ldl -lobjc   clang: error: no such file or directory: 'generator.o' make: ***
[generator.bundle] Error 1

Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/json-1.7.5 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/json-1.7.5/ext/json/ext/generator/gem_make.out

我已经安装了命令行工具

我已经设置 sudo xcode-select -switch /usr/bin

哪个 xcode 选择 /usr/bin/xcode-select

哪个抄送 /usr/bin/cc

有什么想法吗? 谢谢!

【问题讨论】:

标签: ruby


【解决方案1】:

您需要安装完整的 XCode 应用程序才能使用系统 Ruby 为 gem 构建 C 扩展。

如果您不想安装 XCode,另一种选择是使用 rvmruby-buildruby-install 编译您自己的 Ruby。

【讨论】:

    【解决方案2】:

    如果有人使用 Xcode 5:

    1. 从 Xcode 的设置菜单安装命令行
    2. 使用“mac 端口”安装 ruby​​ 1.8.7
    3. 重试“gem install cocopods”

    这解决了我同样的问题。

    【讨论】:

      猜你喜欢
      • 2011-11-22
      • 1970-01-01
      • 2014-03-03
      • 1970-01-01
      • 2020-11-08
      • 1970-01-01
      • 2016-04-09
      • 2020-02-07
      • 2012-08-12
      相关资源
      最近更新 更多