MacOS 无法安装 Jekyll Gem
MacOS Cannot Install Jekyll Gem
我已经尝试了所有方法来尝试安装 jekyll gem。我uninstalled/reinstalled rbenv,安装了ruby 2.6.1,设置为全局,运行 xcode-select --install
大约1000次,运行 xcode-select --switch /Library/Developer/CommandLineTools
,gem update --system
以及其他各种堆栈溢出修复。 None 其中有效。每次,我都会收到这条熟悉的错误消息:
Building native extensions. This could take a while...
ERROR: Error installing jekyll:
ERROR: Failed to build gem native extension.
current directory: /usr/local/lib/ruby/gems/2.6.0/gems/http_parser.rb-0.6.0/ext/ruby_http_parser
/usr/local/opt/ruby/bin/ruby -I
/usr/local/Cellar/ruby/2.6.1/lib/ruby/2.6.0 -r ./siteconf20190302-90413-16ok71q.rb extconf.rb
creating Makefile
current directory: /usr/local/lib/ruby/gems/2.6.0/gems/http_parser.rb-0.6.0/ext/ruby_http_parser
make "DESTDIR=" clean
current directory: /usr/local/lib/ruby/gems/2.6.0/gems/http_parser.rb-0.6.0/ext/ruby_http_parser
make "DESTDIR="
compiling ruby_http_parser.c
In file included from ruby_http_parser.c:1:
In file included from /usr/local/Cellar/ruby/2.6.1/include/ruby-2.6.0/ruby.h:33:
In file included from /usr/local/Cellar/ruby/2.6.1/include/ruby-2.6.0/ruby/ruby.h:29:
/usr/local/Cellar/ruby/2.6.1/include/ruby-2.6.0/ruby/defines.h:123:10: fatal error: 'stdio.h' file not found
#include <stdio.h>
^~~~~~~~~
1 error generated.
make: *** [ruby_http_parser.o] Error 1
make failed, exit code 2
Gem files will remain installed in /usr/local/lib/ruby/gems/2.6.0/gems/http_parser.rb-0.6.0 for inspection.
Results logged to
/usr/local/lib/ruby/gems/2.6.0/extensions/x86_64-darwin-18/2.6.0/http_parser.rb-0.6.0/gem_make.out
编辑:
我正在使用 MacOS 10.14,这是我的 gem 环境:
RubyGems Environment:
- RUBYGEMS VERSION: 3.0.2
- RUBY VERSION: 2.6.1 (2019-01-30 patchlevel 33) [x86_64-darwin18]
- INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/2.6.0
- USER INSTALLATION DIRECTORY: /Users/<username>/.gem/ruby/2.6.0
- RUBY EXECUTABLE: /usr/local/opt/ruby/bin/ruby
- GIT EXECUTABLE: /usr/bin/git
- EXECUTABLE DIRECTORY: /usr/local/lib/ruby/gems/2.6.0/bin
- SPEC CACHE DIRECTORY: /Users/<username>/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY:
/usr/local/Cellar/ruby/2.6.1/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-18
- GEM PATHS:
- /usr/local/lib/ruby/gems/2.6.0
- /Users/<username>/.gem/ruby/2.6.0
- /usr/local/Cellar/ruby/2.6.1/lib/ruby/gems/2.6.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /usr/local/opt/ruby/bin
- /bin
- /Users/<username>/.rbenv/shims
- /Users/<username>/.rbenv/bin
- /Library/Frameworks/Python.framework/Versions/3.6/bin
- /usr/local/bin
- /usr/bin
- /bin
- /usr/sbin
- /sbin
- /opt/X11/bin
- /usr/local/share/dotnet
- /usr/local/go/bin
- /Users/<username>/.rbenv/bin
- /Users/<username>/.rbenv/shims
- /Users/<username>/.rbenv/shims
- /Users/<username>/.rbenv/bin
- /Library/Frameworks/Python.framework/Versions/3.6/bin
- /usr/local/bin
- /usr/bin
- /bin
- /usr/sbin
- /sbin
- /usr/local/go/bin
- /usr/local/share/dotnet
- /opt/X11/bin
- /Users/<username>/.rbenv/bin
- /Users/<username>/.rbenv/shims
- /bin
不确定为什么我的 $PATH 中有这么多重复项,但可能是因为我的 bash_profile.
看起来您的 PATH 设置正在加载系统 ruby 而不是您的 rbenv ruby。
尝试从您的 .bash_profile 中删除这一行,因为您不想使用系统 ruby,而是 RBENV 的版本。
/usr/local/opt/ruby/bin
如果这不起作用,我不确定为什么你的路径中有这么多重复项,可能是因为多次尝试使用 RBENV。
我建议首先重新安装 RBENV。您首先需要通过执行以下操作 uninstall RBENV:
grep rbenv ~/.bashrc ~/.bash_profile ~/.zshrc /etc/profile /etc/profile.d/*
删除可能包含 RBENV 的文件中的任何行。
删除 rbenv
rm -rf ~/.rbenv
如果你使用 homebrew 安装 rbenv,那么
brew uninstall rbenv
然后 brew doctor
看看是否还有其他值得关注的问题。
关闭所有 运行ning 终端,然后打开一个新终端。然后再次检查 gem env
,您应该会看到一个更清晰的状态,与 RBENV 无关,只有您的系统 ruby.
或者如果您愿意,您可以先尝试 RVM,具体操作请参见 https://rvm.io/rvm/install
之后您可能需要重新启动终端,然后转到您的中间人项目文件夹和 运行
bundle install
我已经尝试了所有方法来尝试安装 jekyll gem。我uninstalled/reinstalled rbenv,安装了ruby 2.6.1,设置为全局,运行 xcode-select --install
大约1000次,运行 xcode-select --switch /Library/Developer/CommandLineTools
,gem update --system
以及其他各种堆栈溢出修复。 None 其中有效。每次,我都会收到这条熟悉的错误消息:
Building native extensions. This could take a while...
ERROR: Error installing jekyll:
ERROR: Failed to build gem native extension.
current directory: /usr/local/lib/ruby/gems/2.6.0/gems/http_parser.rb-0.6.0/ext/ruby_http_parser
/usr/local/opt/ruby/bin/ruby -I
/usr/local/Cellar/ruby/2.6.1/lib/ruby/2.6.0 -r ./siteconf20190302-90413-16ok71q.rb extconf.rb
creating Makefile
current directory: /usr/local/lib/ruby/gems/2.6.0/gems/http_parser.rb-0.6.0/ext/ruby_http_parser
make "DESTDIR=" clean
current directory: /usr/local/lib/ruby/gems/2.6.0/gems/http_parser.rb-0.6.0/ext/ruby_http_parser
make "DESTDIR="
compiling ruby_http_parser.c
In file included from ruby_http_parser.c:1:
In file included from /usr/local/Cellar/ruby/2.6.1/include/ruby-2.6.0/ruby.h:33:
In file included from /usr/local/Cellar/ruby/2.6.1/include/ruby-2.6.0/ruby/ruby.h:29:
/usr/local/Cellar/ruby/2.6.1/include/ruby-2.6.0/ruby/defines.h:123:10: fatal error: 'stdio.h' file not found
#include <stdio.h>
^~~~~~~~~
1 error generated.
make: *** [ruby_http_parser.o] Error 1
make failed, exit code 2
Gem files will remain installed in /usr/local/lib/ruby/gems/2.6.0/gems/http_parser.rb-0.6.0 for inspection.
Results logged to
/usr/local/lib/ruby/gems/2.6.0/extensions/x86_64-darwin-18/2.6.0/http_parser.rb-0.6.0/gem_make.out
编辑:
我正在使用 MacOS 10.14,这是我的 gem 环境:
RubyGems Environment:
- RUBYGEMS VERSION: 3.0.2
- RUBY VERSION: 2.6.1 (2019-01-30 patchlevel 33) [x86_64-darwin18]
- INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/2.6.0
- USER INSTALLATION DIRECTORY: /Users/<username>/.gem/ruby/2.6.0
- RUBY EXECUTABLE: /usr/local/opt/ruby/bin/ruby
- GIT EXECUTABLE: /usr/bin/git
- EXECUTABLE DIRECTORY: /usr/local/lib/ruby/gems/2.6.0/bin
- SPEC CACHE DIRECTORY: /Users/<username>/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY:
/usr/local/Cellar/ruby/2.6.1/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-18
- GEM PATHS:
- /usr/local/lib/ruby/gems/2.6.0
- /Users/<username>/.gem/ruby/2.6.0
- /usr/local/Cellar/ruby/2.6.1/lib/ruby/gems/2.6.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /usr/local/opt/ruby/bin
- /bin
- /Users/<username>/.rbenv/shims
- /Users/<username>/.rbenv/bin
- /Library/Frameworks/Python.framework/Versions/3.6/bin
- /usr/local/bin
- /usr/bin
- /bin
- /usr/sbin
- /sbin
- /opt/X11/bin
- /usr/local/share/dotnet
- /usr/local/go/bin
- /Users/<username>/.rbenv/bin
- /Users/<username>/.rbenv/shims
- /Users/<username>/.rbenv/shims
- /Users/<username>/.rbenv/bin
- /Library/Frameworks/Python.framework/Versions/3.6/bin
- /usr/local/bin
- /usr/bin
- /bin
- /usr/sbin
- /sbin
- /usr/local/go/bin
- /usr/local/share/dotnet
- /opt/X11/bin
- /Users/<username>/.rbenv/bin
- /Users/<username>/.rbenv/shims
- /bin
不确定为什么我的 $PATH 中有这么多重复项,但可能是因为我的 bash_profile.
看起来您的 PATH 设置正在加载系统 ruby 而不是您的 rbenv ruby。
尝试从您的 .bash_profile 中删除这一行,因为您不想使用系统 ruby,而是 RBENV 的版本。
/usr/local/opt/ruby/bin
如果这不起作用,我不确定为什么你的路径中有这么多重复项,可能是因为多次尝试使用 RBENV。
我建议首先重新安装 RBENV。您首先需要通过执行以下操作 uninstall RBENV:
grep rbenv ~/.bashrc ~/.bash_profile ~/.zshrc /etc/profile /etc/profile.d/*
删除可能包含 RBENV 的文件中的任何行。
删除 rbenv
rm -rf ~/.rbenv
如果你使用 homebrew 安装 rbenv,那么
brew uninstall rbenv
然后 brew doctor
看看是否还有其他值得关注的问题。
关闭所有 运行ning 终端,然后打开一个新终端。然后再次检查 gem env
,您应该会看到一个更清晰的状态,与 RBENV 无关,只有您的系统 ruby.
或者如果您愿意,您可以先尝试 RVM,具体操作请参见 https://rvm.io/rvm/install
之后您可能需要重新启动终端,然后转到您的中间人项目文件夹和 运行
bundle install