当系统宝石不在$ PATH中时,我遇到了使用自制软件查询系统宝石的问题。
这是我的gem env
,表明我的宝石安装在我的.rvm / gems目录中:
RubyGems Environment:
- RUBYGEMS VERSION: 2.4.5
- RUBY VERSION: 2.2.2 (2015-04-13 patchlevel 95) [x86_64-darwin14]
- INSTALLATION DIRECTORY: /Users/scott/.rvm/gems/ruby-2.2.2
- RUBY EXECUTABLE: /usr/local/opt/ruby/bin/ruby
- EXECUTABLE DIRECTORY: /Users/scott/.rvm/gems/ruby-2.2.2/bin
- SPEC CACHE DIRECTORY: /Users/scott/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /usr/local/Cellar/ruby/2.2.2/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-14
- GEM PATHS:
- /Users/scott/.rvm/gems/ruby-2.2.2
- /Users/scott/.rvm/gems/ruby-2.2.2@global
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- :sources => ["http://gems.rubyforge.org/", "http://gems.github.com"]
- :benchmark => false
- "gem" => "--no-ri --no-rdoc"
- REMOTE SOURCES:
- http://gems.rubyforge.org/
- http://gems.github.com
- SHELL PATH:
- /Users/scott/.rvm/gems/ruby-2.2.2/bin
- /Users/scott/.rvm/gems/ruby-2.2.2@global/bin
- /Users/scott/.rvm/rubies/ruby-2.2.2/bin
- /usr/local/bin
- /usr/bin
- /bin
- /usr/sbin
- /sbin
- /opt/X11/bin
- /Users/scott/.rvm/bin
- /Users/scott/.composer/vendor/bin
- /usr/local/sbin
现在这是我不断收到的各种命令的错误信息(特别是来自brew services start httpd22
):
Error: ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
Extracting libxml2-2.8.0.tar.gz into tmp/x86_64-apple-darwin14.3.0/ports/libxml2/2.8.0... OK
Running 'compile' for libxml2 2.8.0... ERROR, review 'tmp/x86_64-apple-darwin14.3.0/ports/libxml2/2.8.0/compile.log' to see what happened.
/Library/Ruby/Gems/2.0.0/gems/mini_portile-0.5.2/lib/mini_portile.rb:265:in `block in execute': Failed to complete compile task (RuntimeError)
from /Library/Ruby/Gems/2.0.0/gems/mini_portile-0.5.2/lib/mini_portile.rb:257:in `chdir'
from /Library/Ruby/Gems/2.0.0/gems/mini_portile-0.5.2/lib/mini_portile.rb:257:in `execute'
from /Library/Ruby/Gems/2.0.0/gems/mini_portile-0.5.2/lib/mini_portile.rb:69:in `compile'
from /Library/Ruby/Gems/2.0.0/gems/mini_portile-0.5.2/lib/mini_portile.rb:109:in `cook'
from extconf.rb:101:in `block in <main>'
from extconf.rb:119:in `call'
from extconf.rb:119:in `block in <main>'
from extconf.rb:109:in `tap'
from extconf.rb:109:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/nokogiri-1.6.1 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/extensions/universal-darwin-14/2.0.0/nokogiri-1.6.1/gem_make.out
了解它如何看待Ruby&amp;的系统版本。宝石?我安装了XCode并且是最新的。
brew doctor
没有结果,brew update
已准备好酿造。
我正在使用OS 10.10.3。我忘记了任何事情,只要问一下。
修改
这是我的.zshrc $ PATH导出:
export PATH="$PATH:$HOME/.composer/vendor/bin"
export PATH="$PATH:/usr/local/sbin"
export PATH="$PATH:$HOME/.rvm/bin"
编辑2
$GEM_HOME
/Users/scott/.rvm/gems/ruby-2.2.2
$GEM_PATH
/Users/scott/.rvm/gems/ruby-2.2.2:/Users/scott/.rvm/gems/ruby-2.2.2@global
思想?
答案 0 :(得分:0)
看着brew:
https://github.com/Homebrew/homebrew/blob/master/bin/brew
https://github.com/Homebrew/homebrew/blob/master/bin/brew#L22
所以brew正在扰乱GEM_PATH并做自己的事情。
答案 1 :(得分:0)
找到答案,系统rubygems.rb引用了错误版本的Ruby。更多详情:https://github.com/Homebrew/homebrew/issues/31220