App Academy

Rails Error Can't Find

Hello everyone,

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/ There was a connection with the mimemagic dependencies, and I found this issue on GitHub about the mimemagic version and licensing - Dependency on mimemagic 0.3.x no longer valid · Issue #41750 · rails/rails · GitHub

Wondering if anybody else ran into the issue, and could explain what was the issue about licensing for mimemagic.

I found some links to shared-mime-info in the GitHub issue, and I solved it by installing the shared-mime-info package (below).

Here are the errors when I start a new project, in case someone runs into the same thing. I’m using rbenv with ruby version: 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-darwin19], and rails 6.1.3

Error message in the command line:

Installing railties 6.1.3
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /Users/nicopierson/.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
rake aborted!
Could not find MIME type database in the following locations: ["/usr/local/share/mime/packages/",
"/opt/homebrew/share/mime/packages/", "/usr/share/mime/packages/"]

Ensure you have either installed the shared-mime-types package for your distribution, or 
obtain a version of 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 solved the issue by running the command:

brew install shared-mime-info