久しぶりにMacで開発しようとしたところ、gemのインストール時、Native Extensionのビルドで失敗した。
[email protected] ~ % sudo gem install vacuum
(snip)
Building native extensions. This could take a while...
ERROR: Error installing vacuum:
ERROR: Failed to build gem native extension.
current directory: /Library/Ruby/Gems/2.6.0/gems/unf_ext-0.0.7.7/ext/unf_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 ./siteconf20201114-13904-1ksz595.rb extconf.rb
checking for -lstdc++... *** 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.
新しいMacということもあり、コマンドラインツールのインストールを忘れたかと思ったが、
[email protected] ~ % xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
となり入っているっぽい。
自分とは環境が違うものの、コマンドラインツールをパッケージからのインストールで改善したという記事を見つけ、Command Line Tools for Xcode 12.2をダウンロードしてインストールしたところ、うまくビルドできた。
たびたび、同じようなことをやっているので書き残しておく。