Failed to build gem native extension when bundling mimemagic
If you are trying to install mimemagic with bundle install
or gem install
on a Mac, you might receive an error
ERROR: Error installing mimemagic:
ERROR: Failed to build gem native extension.
Additionally your error might include
Could not find MIME type database in the following locations: ["/usr/local/share/mime/packages/freedesktop.org.xml", "/opt/homebrew/share/mime/packages/freedesktop.org.xml", "/opt/local/share/mime/packages/freedesktop.org.xml", "/usr/share/mime/packages/freedesktop.org.xml"]
To fix this, run the following:
brew install shared-mime-info
Once that has completed, run bundle
again or gem install mimemagic
.