我无法在 Mountain Lion 上全新安装 rbenv 的 Ruby 1.8.6 上安装任何 gem。gem install
段错误和外壳打印“中止陷阱:6”:
$ RUBYLIB= RUBYOPT= bash
$ gem install --verbose bundler
GET http://rubygems.org/latest_specs.4.8.gz
302 Moved Temporarily
GET http://production.s3.rubygems.org/latest_specs.4.8.gz
304 Not Modified
Installing gem bundler-1.3.5
Abort trap: 6
报告了类似的问题,但所有问题的答案都是他们需要使用非 Apple GCC 4.2 来构建这样一个旧版本的 Ruby。这不适用于我,因为我已经安装了 GCC,brew install apple-gcc42
并且 rbenv 安装过程选择了它,如下所示:
$ gem env
RubyGems Environment:
- RUBYGEMS VERSION: 1.3.7
- RUBY VERSION: 1.8.6 (2010-09-02 patchlevel 420) [i686-darwin12.3.0]
- INSTALLATION DIRECTORY: /Users/mislav/.rbenv/versions/1.8.6-p420/lib/ruby/gems/1.8
- RUBY EXECUTABLE: /Users/mislav/.rbenv/versions/1.8.6-p420/bin/ruby
- EXECUTABLE DIRECTORY: /Users/mislav/.rbenv/versions/1.8.6-p420/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86-darwin-12
- GEM PATHS:
- /Users/mislav/.rbenv/versions/1.8.6-p420/lib/ruby/gems/1.8
- /Users/mislav/.gem/ruby/1.8
- GEM CONFIGURATION:
- "gem" => "--no-ri --no-rdoc"
- REMOTE SOURCES:
- http://rubygems.org/
$ ruby -rrbconfig -e 'puts RbConfig::CONFIG["configure_args"]'
'--prefix=/Users/mislav/.rbenv/versions/1.8.6-p420'
'CC=/usr/local/bin/gcc-4.2'
'CFLAGS= -Wno-error=shorten-64-to-32'
'LDFLAGS=-L'\\''/Users/mislav/.rbenv/versions/1.8.6-p420/lib'\\'' '
'CPPFLAGS=-I'\\''/Users/mislav/.rbenv/versions/1.8.6-p420/include'\\'' '
$ /usr/local/bin/gcc-4.2 --version
i686-apple-darwin11-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3)