[Ruby FAQs Bundler] Could not find MIME type database in the following locations when run bundle

Could not find MIME type database in the following locations

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
$ bundle
...
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory: /Users/cloudolife/.rvm/gems/ruby-3.0.0/gems/mimemagic-0.4.3/ext/mimemagic
/Users/cloudolife/.rvm/rubies/ruby-3.0.0/bin/ruby -I/Users/cloudolife/.rvm/rubies/ruby-3.0.0/lib/ruby/site_ruby/3.0.0 -rrubygems
/Users/cloudolife/.rvm/gems/ruby-3.0.0/gems/rake-13.0.6/exe/rake
RUBYARCHDIR\=/Users/cloudolife/.rvm/gems/ruby-3.0.0/extensions/x86_64-darwin-20/3.0.0/mimemagic-0.4.3
RUBYLIBDIR\=/Users/cloudolife/.rvm/gems/ruby-3.0.0/extensions/x86_64-darwin-20/3.0.0/mimemagic-0.4.3
rake aborted!
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"]

Ensure you have either installed the shared-mime-info package for your distribution, or
obtain a version of freedesktop.org.xml and set FREEDESKTOP_MIME_TYPES_PATH to the location
of that file.
/Users/cloudolife/.rvm/gems/ruby-3.0.0/gems/mimemagic-0.4.3/ext/mimemagic/Rakefile:15:in `locate_mime_database'
/Users/cloudolife/.rvm/gems/ruby-3.0.0/gems/mimemagic-0.4.3/ext/mimemagic/Rakefile:26:in `block in <top (required)>'
/Users/cloudolife/.rvm/gems/ruby-3.0.0/gems/rake-13.0.6/exe/rake:27:in `<main>'
Tasks: TOP => default
(See full trace by running task with --trace)

Install shared-mime-info package to resolve that issue.

1
2
3
4
5
# macOS
$ brew install shared-mime-info

# Debian, Ubuntu
# apt-get update && apt-get install -y shared-mime-info

References

[1] Mimemagic - Could not find MIME type database in the following locations: :: 쉽게 개발 - https://dev-is-easy.tistory.com/entry/Mimemagic-Could-not-find-MIME-type-database-in-the-following-locations?category=994498

[2] RubyGems.org | your community gem host - https://rubygems.org/

[3] Bundler: The best way to manage a Ruby application’s gems - https://bundler.io/