前提
$ ruby -v
ruby 2.6.6p146 (2020-03-31 revision 67876) [x86_64-darwin21]
$ uname -m
x86_64
起きたエラー
An error occurred while installing mimemagic (0.3.10), and Bundler cannot continue.
エラー詳細
$ bundle install
Fetching gem metadata from https://rubygems.org/..........
Using rake 13.0.6
Using minitest 5.16.3
Using thread_safe 0.3.6
<略>
Fetching sassc-rails 2.1.2
Installing mimemagic 0.3.10 with native extensions
Installing sassc-rails 2.1.2
Fetching sass-rails 6.0.0
Installing sass-rails 6.0.0
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /Users/kkosuke/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/mimemagic-0.3.10/ext/mimemagic
<略>
An error occurred while installing mimemagic (0.3.10), and Bundler cannot continue.
In Gemfile:
rails was resolved to 6.0.3, which depends on
actionmailbox was resolved to 6.0.3, which depends on
activestorage was resolved to 6.0.3, which depends on
marcel was resolved to 0.3.3, which depends on
mimemagic
とりあえず検索
ヒットした記事
解決策
$ brew install shared-mime-info
試してみた。
$ brew install shared-mime-info
Running `brew update --auto-update`...
==> Auto-updated Homebrew!
Updated 2 taps (homebrew/core and homebrew/cask).
==> New Formulae
pinocchio
==> New Casks
<略>
==> Upgrading libidn2
2.3.2 -> 2.3.4
==> Pouring libidn2--2.3.4.monterey.bottle.tar.gz
🍺 /usr/local/Cellar/libidn2/2.3.4: 79 files, 1.2MB
==> Running `brew cleanup libidn2`...
Removing: /usr/local/Cellar/libidn2/2.3.2... (77 files, 846.7KB)
==> Checking for dependents of upgraded formulae...
==> No broken dependents found!
出来たっぽい。
もう一度、bundle installを試してみる。
$ bundle install
Fetching gem metadata from https://rubygems.org/..........
Using rake 13.0.6
Using concurrent-ruby 1.1.10
<略>
Using sass-rails 6.0.0
Installing mimemagic 0.3.10 with native extensions
Fetching marcel 0.3.3
Installing marcel 0.3.3
Fetching activestorage 6.0.3
Installing activestorage 6.0.3
Fetching actiontext 6.0.3
Fetching actionmailbox 6.0.3
Installing actiontext 6.0.3
Installing actionmailbox 6.0.3
Fetching rails 6.0.3
Installing rails 6.0.3
Bundle complete! 17 Gemfile dependencies, 77 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
解決しました!