macOS: Bundle Install Error – Ensure you have either installed the shared-mime-info package for your distribution

When performing a bundle install for a Rails 6.1.3 + Ruby 3.0.0 on macOS Catalina or Big Sur, you may run into the following error:

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

...

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.

...

If this happens, you will need to install the shared-mime-info package for macOS.

> brew install shared-mime-info

If the preceding command fails, it is most likely due to some missing Xcode dev tools that need to be installed so the package can be properly compiled for your distribution of macOS. The error messages you receive will tell you exactly the Xcode dev tools that need to be installed as well as the command to execute to make it happen.

Better yet, if you can, upgrade your Rails project to version 6.1.3.1 or higher, as the 0.0.0.1 revision was created to fix the shared-mime-info defect caused by the mimemagic gem.

Published by

Tim Clark

Experienced Business Owner, Chief Information Officer, Vice President, Chief Software Architect, Application Architect, Project Manager, Software Developer, Senior Web Developer, Graphic Designer & 3D Modeler, University Instructor, University Program Chair, Academic Director. Specialties: Ruby, Ruby on Rails, JavaScript, JQuery, AJAX, Node.js, React.js, Angular.js, MySQL, PostgreSQL, MongoDB, SQL Server, Responsive Design, HTML5, XHTML, CSS3, C#, ASP.net, Project Management, System Design/Architecture, Web Design, Web Development, Adobe CS6 (Photoshop, Illustrator)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s