5
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

【Rails】Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

Last updated at Posted at 2022-04-16

開発環境

Rails6.1.4
Ruby3.0.1
macOS Monterey 12.2.1


エラー内容

gem(rinku)をbundle installしようとしたら、いきなりエラーが発生してインストールできなくなった🤯

terminal
Installing rinku 2.0.6 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory: /Users/apple/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/rinku-2.0.6/ext/rinku
/Users/apple/.rbenv/versions/3.0.1/bin/ruby -I /Users/apple/.rbenv/versions/3.0.1/lib/ruby/3.0.0 -r
./siteconf20220416-552-xpdj2a.rb extconf.rb
creating Makefile

current directory: /Users/apple/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/rinku-2.0.6/ext/rinku
make DESTDIR\= clean
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at:
/Library/Developer/CommandLineTools/usr/bin/xcrun

current directory: /Users/apple/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/rinku-2.0.6/ext/rinku
make DESTDIR\=
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at:
/Library/Developer/CommandLineTools/usr/bin/xcrun

make failed, exit code 1

Gem files will remain installed in /Users/apple/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/rinku-2.0.6 for
inspection.
Results logged to
/Users/apple/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/extensions/x86_64-darwin-20/3.0.0/rinku-2.0.6/gem_make.out

〜省略〜

An error occurred while installing rinku (2.0.6), and Bundler cannot continue.


解決方法

こちらの記事を参考にさせていただき、下記を実行

terminal
% xcode-select --install

ポップアップが出てくるので、同意してインストール✅


インストールが終わった後、再度bundle installすると無事できました〜🎉


原因

macOSアップデート後に出ることが多いらしいです。

最後に

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.の解決法に関する記事が少なく、かなり苦戦したため本記事を執筆しました!
この記事が多くの悩める方に届けば幸いです🌱

5
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?