ruby - 无法在 Mac OSX 10.8.3 上运行 ruby

标签 ruby macos macports

几天来,我一直试图让 Ruby 在我的 Mac 上运行,但我所做的一切似乎都没有成功。我已经安装了 MacPorts 并关注了这里的帖子:Installing Ruby on Mac OS X 10.8.2

我运行了以下命令:

sudo port selfupdate
sudo port install apple-gcc42

他们成功完成然后我运行下面的行:

CC=/opt/local/bin/gcc-apple-4.2 rvm install ruby-1.9.3-p194 --enable-shared --without-tk --without-tcl

在我运行该行后,需要几分钟时间,我得到以下信息:

enter code here MacPorts base is already the latest version DEBUG: Setting MacPorts sources ownership to root The ports tree has been updated. To upgrade your installed ports, you should run port upgrade outdated i686-apple-darwin12-gcc-apple-4.2.1: no input files Missing required packages: autoconf, automake, libtool, pkgconfig, libiconv, libyaml, readline, libxml2, libxslt, libksba, openssl, curl-ca-bundle, sqlite3, zlib, ncurses, gdbm. Cowardly refusing to continue, please read 'rvm autolibs'. There were package installation errors, make sure to read the log.

我是否需要安装它引用的缺失包?如果是这样,我该怎么做?我对 MacPorts 不是很熟悉,如果您能帮助我完成这项工作,我将不胜感激。

因为我最初是通过https://rvm.io/rvm/install/去安装RVM的我按照第一个命令使用 ruby​​ 进入 RVM:

$ \curl -#L https://get.rvm.io | bash -s stable --autolibs=3 --ruby

在我运行它下载并编译的命令之后,当它为 ruby​​-2.0.0-p0 安装 ruby​​gems-2.0.3 时,它给出了以下错误消息:

Error running 'env GEM_PATH=/usr/local/rvm/gems/ruby-2.0.0-p0:/usr/local/rvm/gems/ruby-2.0.0-p0@global:/usr/local/rvm/gems/ruby-2.0.0-p0:/usr/local/rvm/gems/ruby-2.0.0-p0@global GEM_HOME=/usr/local/rvm/gems/ruby-2.0.0-p0 /usr/local/rvm/rubies/ruby-2.0.0-p0/bin/ruby -d /usr/local/rvm/src/rubygems-2.0.3/setup.rb --verbose', please read /usr/local/rvm/log/ruby-2.0.0-p0/rubygems.install.log

然后我去打开日志文件,在底部它说

ERROR: While executing gem ... (NoMethodError) undefined method fu_stream_blksize for #<Gem::Commands::SetupCommand:0x007fa09b05d7a8> Installing RubyGems Installing gem executable

知道我接下来可以做什么吗?

提前致谢。

最佳答案

我在 OS X 10.8.3 和 XCode 4.6.1 上遇到了类似的问题。经过一些谷歌搜索后,我尝试使用类似的 RVM 命令进行安装,除了使用 clang 的 XCode 版本(符号链接(symbolic link)到/usr/bin/cc)。试试这个:

\curl -#L https://get.rvm.io | bash -s stable    #just get rvm

source ~/.rvm/scripts/rvm

rvm get head  # update to latest rvm

CC=/usr/bin/cc rvm install ruby

安装 ruby​​gems-2.0.3 应该有同样的失败,但是重新安装 ruby​​gems 应该可以:

CC=/usr/bin/cc rvm install rubygems latest  # substitute "2.0.3" for "latest" if you like.

看起来这是一个 bug in rubygems计划在 2.0.4 中修复。

希望对您有所帮助!

关于ruby - 无法在 Mac OSX 10.8.3 上运行 ruby,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15645379/

相关文章:

ruby - 如何配置 capistrano 以使用我的 Ruby rvm 版本

ruby-on-rails - ActiveRecord::Migration 前置上下文和方法

java - 从 Java 查询 Mac OS X Spotlight

python - "OSError: dlopen(libSystem.dylib, 6): image not found"(OS X + macports + celery 3.1.7)

ruby-on-rails - Ruby 和编码转换

ruby-on-rails - 执行脚本并在 View 中显示输出/进度 [Ruby/Sinatra(Rails)]

macos - 找不到架构 x86_64 编译错误的 LLVM OS X 符号

xcode - 复制文件阶段正在获取最后构建的产品

homebrew - 卸载MacPorts

Python、Macports 和缓冲区问题