30

I've had some issues starting a new RAILS project, where I'm getting an error that there is a missing file /usr/local/share/mime/packages/freedesktop.org.xml. There was a connection with the mimemagic dependencies, and I found this issue on GitHub about the mimemagic version and licensing - https://github.com/rails/rails/issues/41750

Wondering if anybody else ran into the issue, and could explain what is going on.

I'm using rbenv with ruby version: 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-darwin19], and rails 6.1.3

Here is the error message in the command line:

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

Thanks, Nico

nicogpt
  • 839
  • 1
  • 5
  • 7

3 Answers3

53

Found some links to shared-mime-info on the GitHub link I posted, and I solved the issue by running the command below and starting a new project:

brew install shared-mime-info
nicogpt
  • 839
  • 1
  • 5
  • 7
5

If you are on ubuntu OS you can run below command

sudo apt-get install shared-mime-info

Jagadeeswar
  • 537
  • 1
  • 7
  • 9
1

If migrating data from an Intel Mac (or an M1 Mac running Rosetta 2) to an M1, note that mimemagic will cache the old directory, so in addition to brew install shared-mime-info, you'll want to run:

gem uninstall mimemagic
gem install mimemagic
Aaron Brager
  • 65,323
  • 19
  • 161
  • 287