Macbook Pro 13インチ(2020年モデル)にruby環境を構築していた時に、デバッグ用Gemのインストールにつまずきました。
#今回実行した環境
Catalina 10.15.4
デバッグ用Gem導入
デバッグ用のgemをbundler経由で導入します。
$ gem install bundler
$ bundle init
$ gem install debase
$ gem install ruby-debug-ide
エラーを吐きます。
uilding native extensions. This could take a while...
ERROR: Error installing debase:
ERROR: Failed to build gem native extension.
current directory: /Library/Ruby/Gems/2.6.0/gems/debase-0.2.4.1/ext
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0 -r ./siteconf20200608-81290-fde397.rb extconf.rb
checking for vm_core.h... no
checking for vm_core.h... no
**************************************************************************
No source for ruby-2.6.3-p62 (revision 67580) provided with
debase-ruby_core_source gem. Falling back to ruby-2.6.0-p0.
**************************************************************************
checking for vm_core.h... yes
checking for iseq.h... no
Makefile creation failed
*************************************************************
NOTE: If your headers were not found, try passing
--with-ruby-include=PATH_TO_HEADERS
*************************************************************
*** 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=/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/$(RUBY_BASE_NAME)
--with-ruby-dir
--without-ruby-dir
--with-ruby-include
--without-ruby-include=${ruby-dir}/include
--with-ruby-lib
--without-ruby-lib=${ruby-dir}/lib
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/Library/Ruby/Gems/2.6.0/extensions/universal-darwin-19/2.6.0/debase-0.2.4.1/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /Library/Ruby/Gems/2.6.0/gems/debase-0.2.4.1 for inspection.
Results logged to /Library/Ruby/Gems/2.6.0/extensions/universal-darwin-19/2.6.0/debase-0.2.4.1/gem_make.out
調べてみると、debase-ruby_core_sourceとrubyのバージョン2.6.3が不整合のようです。
そのため、rubyのバージョンを変更しました。
$ brew update
$ brew install rbenv
$ rbenv --version
rbenv 1.1.2
$ rbenv install 2.6.6
$ rbenv global 2.6.6
無事、デバッグ用Gemをインストールできるようになりました。