Building native extensions. This could take a while... ERROR: Error installing libxml-ruby: ERROR: Failed to build gem native extension. current directory: /Users/shigerunakajima/.rbenv/versions/2.5.5/lib/ruby/gems/2.5.0/gems/libxml-ruby-3.1.0/ext/libxml /Users/shigerunakajima/.rbenv/versions/2.5.5/bin/ruby -r ./siteconf20200414-17043-wpqllw.rb extconf.rb /Users/shigerunakajima/.rbenv/versions/2.5.5/bin/ruby: warning: shebang line ending with \r may cause problems checking for libxml/xmlversion.h in /opt/include/libxml2,/opt/local/include/libxml2,/usr/local/include/libxml2,/usr/include/libxml2... no *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options. Provided configuration options: --with-opt-dir --without-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=/Users/shigerunakajima/.rbenv/versions/2.5.5/bin/$(RUBY_BASE_NAME) --with-xml2-config --without-xml2-config --with-xml2-dir --without-xml2-dir --with-xml2-include --without-xml2-include=${xml2-dir}/include --with-xml2-lib --without-xml2-lib=${xml2-dir}/lib extconf failure: need libxml2. Install the library or try one of the following options to extconf.rb: --with-xml2-config=/path/to/xml2-config --with-xml2-dir=/path/to/libxml2 --with-xml2-lib=/path/to/libxml2/lib --with-xml2-include=/path/to/libxml2/include To see why this extension failed to compile, please check the mkmf.log which can be found here: /Users/shigerunakajima/.rbenv/versions/2.5.5/lib/ruby/gems/2.5.0/extensions/x86_64-darwin-18/2.5.0/libxml-ruby-3.1.0/mkmf.log extconf failed, exit code 1 Gem files will remain installed in /Users/shigerunakajima/.rbenv/versions/2.5.5/lib/ruby/gems/2.5.0/gems/libxml-ruby-3.1.0 for inspection. Results logged to /Users/shigerunakajima/.rbenv/versions/2.5.5/lib/ruby/gems/2.5.0/extensions/x86_64-darwin-18/2.5.0/libxml-ruby-3.1.0/gem_make.out
libxml2が見つからないみたいです。
~ brew install libxml2 Warning: libxml2 2.9.10_1 is already installed and up-to-date To reinstall 2.9.10_1, run `brew reinstall libxml2`
Homebrew的にはインストール済みです。
checking for libxml/xmlversion.h in /opt/include/libxml2,/opt/local/include/libxml2,/usr/local/include/libxml2,/usr/include/libxml2... no
とエラーメッセージが出ています。ヘッダファイル自体はあります。
~ ls /usr/local/opt/libxml2/include/libxml2/libxml/xmlversion.h /usr/local/opt/libxml2/include/libxml2/libxml/xmlversion.h
ヘッダファイルを探すパスに /usr/local/opt/libxml2/include/libxml2 が入っていないのが問題のようです。
~ bundle config build.libxml-ruby --with-xml2-config=/usr/local/opt/libxml2/bin/xml2-config ~ bundle config Settings are listed in order of priority. The top value will be used. build.libxml-ruby Set for the current user (/Users/shigerunakajima/.bundle/config): "--with-xml2-config=/usr/local/opt/libxml2/bin/xml2-config"
gem installは失敗します。だってbundle configだもん。 でもbundle installは成功するので、大丈夫でした!