Ethan Harwell
Ethan Harwell

Reputation: 171

gem install mimemagic -v '0.3.10' fails to install on Big Sur

Mac OS Big Sur 11.4

** Rails 6.1.0 ** however, my use case is for a Rails Engine that I am writing that targets Rails 6.1+ applications

xcode-select version 2384.

GCC version % gcc -v Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1 Apple clang version 12.0.5 (clang-1205.0.22.11) Target: arm64-apple-darwin20.5.0 Thread model: posix InstalledDir: /Library/Developer/CommandLineTools/usr/bin

the gem I am trying to install is

mimemagic 0.3.15 installed with bundler Bundler version 2.2.19

this is in a non-Rails application that uses bundler. in my app mimemagic is resolving (new) to 0.3.5, but won't install on Mac OS Big Sur

gem install mimemagic -v '0.3.10' --source 'https://rubygems.org/'

the result is

Building native extensions. This could take a while... ERROR:  Error
installing mimemagic:   ERROR: Failed to build gem native extension.

    current directory: /Users/jason/.rvm/gems/ruby-2.6.3/gems/mimemagic-0.3.10/ext/mimemagic
/Users/jason/.rvm/rubies/ruby-2.6.3/bin/ruby -rrubygems
/Users/jason/.rvm/gems/ruby-2.6.3/gems/rake-13.0.3/exe/rake
RUBYARCHDIR\=/Users/jason/.rvm/gems/ruby-2.6.3/extensions/-darwin-20/2.6.0/mimemagic-0.3.10
RUBYLIBDIR\=/Users/jason/.rvm/gems/ruby-2.6.3/extensions/-darwin-20/2.6.0/mimemagic-0.3.10
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.

This gem might be installed as a dependency of some bigger package,
such as rails, activestorage, axlsx or cucumber. While most of these
packages use the functionality of this gem, some gems have included
this gem by accident. Set USE_FREEDESKTOP_PLACEHOLDER=true if you are
certain that you do not need this gem, and wish to skip the inclusion
of freedesktop.org.xml.

The FREEDESKTOP_PLACEHOLDER option is meant as a transitional feature,
and will be deprecated in the next release.
/Users/jason/.rvm/gems/ruby-2.6.3/gems/mimemagic-0.3.10/ext/mimemagic/Rakefile:15:in
`locate_mime_database'
/Users/jason/.rvm/gems/ruby-2.6.3/gems/mimemagic-0.3.10/ext/mimemagic/Rakefile:39:in
`block in <top (required)>'
/Users/jason/.rvm/gems/ruby-2.6.3/gems/rake-13.0.3/exe/rake:27:in
`<main>' Tasks: TOP => default (See full trace by running task with
--trace)

rake failed, exit code 1

Gem files will remain installed in
/Users/jason/.rvm/gems/ruby-2.6.3/gems/mimemagic-0.3.10 for
inspection. Results logged to
/Users/jason/.rvm/gems/ruby-2.6.3/extensions/-darwin-20/2.6.0/mimemagic-0.3.10/gem_make.out
jason@Rose21 hot-glue % bundler -v Bundler version 2.2.19

enter image description here

Upvotes: 16

Views: 9279

Answers (2)

Evolve
Evolve

Reputation: 9219

marcel gem v1.0 removes the 'mimemagic' dependancy. https://github.com/rails/marcel/releases/tag/v1.0.0

Upgrading to Marcel v1.0:

gem "marcel", "~> 1.0" 

Should mean you no longer are asked to install 'mimemagic'.

NB. Practically I came across this error doing a rails 5.2 to Rails 6.0 upgrade. Upgrading rails from "6.0.0" to latest "6.0.x" (6.0.6.1 for me at date of writing) made the error go away. Presumably later 6.0.x versions have upgraded their marcel dependancy to v1.0 or later.

Upvotes: -1

Jason FB
Jason FB

Reputation: 5940

--SOLVED--

TO FIX:

brew install shared-mime-info

or

sudo apt-get install shared-mime-info

Upvotes: 47

Related Questions