sudo xcode-select --switch /Applications/Xcode.app
sudo xcodebuild -license accept
gem install eventmachine
システムのバージョン詳細: Brewfile.lock.json
--with-cppflags
ではダメだったmacOS に eventmachine をインストールしようとしたら失敗した。
ネットで記事を調べると、以下の解決法しか出てこないが、これだとインストールできなかった。
gem install eventmachine -- --with-cppflags=-I/usr/local/opt/openssl/include
真面目にログを見てみる。
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5: return !!argv[argc];
6: }
/* end */
"pkg-config --exists openssl"
package configuration for openssl is not found
package configuration for openssl is not found
が気になる。
でも、OpenSSL はちゃんと最新版がインストールされているし、--with-ssl-include
とか --with-cppflags
とか --with-openssl-config
とか、OpenSSL に関連しそうなオプションをいろいろ付けてみたけどダメだった。
package configuration for openssl is not found
って出てくるけど、どうやら OpenSSL の問題だけではなさそう。
次に気になるのは xcrun: error: invalid active developer path
だ。
CommandLineTools
のパスがなんかおかしいと言われている。
ここで、ふと、自分が以前に書いた記事を思い出した。
https://ja.developers.noraworld.blog/brew-install-and-update-failure-on-macos-mojave
すると、過去にも全く同じ警告が出ていることがわかった。
brew doctor
そこで、brew doctor
を試してみた。
brew doctor
Warning: Your Xcode is configured with an invalid path.
You should change it to the correct path:
sudo xcode-select --switch /Applications/Xcode.app
どうやらこれを実行すれば良さそう。
sudo xcode-select --switch /Applications/Xcode.app
その後、もう一度 brew doctor
を実行すると、以下のエラーが出た。
brew doctor
Error: You have not agreed to the Xcode license. Please resolve this by running:
sudo xcodebuild -license accept
ライセンスに同意していないので同意してくれということらしいので、同意する。
sudo xcodebuild -license accept
そして、さらにもう一度 brew doctor
を実行すると、警告が消えた。
ここで、最初に戻り、eventmachine をインストールしようとしたら、インストールできた。
gem install eventmachine
結局、オプション (--with-ssl-include
とか --with-cppflags
とか --with-openssl-config
とか) は要らなかった。
困ったときは、brew doctor
。