[Solved] Could not find MIME type database in the following locations: "/usr/local/share/mime/packages/freedesktop.org.xml" | Ruby on Rails
Article
Mashpy Rahman
Problem:
When I was starting new rails project, I was getting an error -
Installing railties 6.1.3 Gem::Ext::BuildError: ERROR: Failed to build gem native extension. current directory: /Users/nico/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/mimemagic-0.3.7/ext/mimemagic /Users/nico/.rbenv/versions/3.0.0/bin/ruby -I/Users/nico/.rbenv/versions/3.0.0/lib/ruby/3.0.0 -rrubygems /Users/nico/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/rake-13.0.3/exe/rake RUBYARCHDIR\=/Users/nico/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/extensions/x86_64-darwin-19/3.0.0/mimemagic-0.3.7 RUBYLIBDIR\=/Users/nico/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/extensions/x86_64-darwin-19/3.0.0/mimemagic-0.3.7 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", "/usr/share/mime/packages/freedesktop.org.xml"] Ensure you have either installed the shared-mime-types package for your distribution, or obtain a version of freedesktop.org.xml and set FREEDESKTOP_MIME_TYPES_PATH to the location of that file. Tasks: TOP => default (See full trace by running task with --trace) rake failed, exit code 1
I am using ruby version 3 and rails version 6.1
Solution:
To solve this problem install shared-mime-info package on your ubuntu machine.
sudo apt-get install shared-mime-info
And for mac you can run -
brew install shared-mime-info
Thank you for reading the article. If still now you are facing the problem, please comment below.