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.

macOS Big Sur: Flutter Error – “dart” can’t be opened because Apple cannot check it for malicious software.

After installing macOS Big Sur, you may run into issues getting Flutter set back up for development. Due to the security enhancements added to Catalina and increased in Big Sur, you may run into macOS blocking the execution of some development tools like Flutter and Dart.

If you run into the error message: “dart” can’t be opened because Apple cannot check it for malicious software.

You simply need to:

  1. Open system preferences/Security & Privacy/General
  2. Unlock by clicking the clock in the bottom left and enter your admin password
  3. Where it has the warning that “dart” was blocked, click “allow anyway”

Tech Tutorial: Learning Node.js for JavaScript Programming – Complete Playlist

Being that JavaScript was written as a scripting language for the browser and lived within browsers only for about 15 years, it was quite the surprise when the developers of Node.js moved it to the desktop/server. Node.js is the Chrome V8 JavaScript execution environment pulled out of the Chrome browser and modified to run directly on computers, whether those computers be desktops, laptops, or servers, it really doesn’t matter, JavaScript now runs everywhere.

As soon as JavaScript could be executed on computers it opened up new possibilities. Probably the best thing to happen was that web developers could now use JavaScript program their web applications from the back-end all the way to the front-end, it was no longer simply a scripting language for the browser. No longer do web developers need to know other programming languages or rely on other developers who do to build their back-end server-base systems, it can all be done in JavaScript.

In this technical tutorial series, you learn the basics of the Node.js JavaScript execution environment and you write your first Node.js application that can be executed on your computer, not your browser.

Tech Tutorial: Learn to Program with JavaScript – Complete Playlist

JavaScript is an amazing technology and without it the Internet would be a pretty boring place full of static HTML pages. In this technical tutorial series, you will learn the basics of programming while at the same time learning one of the most versatile programming languages in existence. After you master the concepts taught in this series, you may even be able to change your life and become a web developer. All you have to do is give it a try…

Ubuntu + Rmagick + Gem

 

If you run into trouble installing Rmagick on Ubuntu, it is most likely because you do not have the dev libraries installed that are needed by the rmagick Ruby Gem. Run the following commands in your terminal and everything should work fine.

sudo apt-get install graphicsmagick-libmagick-dev-compat
sudo apt-get install imagemagick
sudo apt-get install libmagickcore-dev
sudo apt-get install libmagickwand-dev
gem install rmagick

Rails 4: gem install pg (when using the Postgresql App on OS X)

If you are getting a build error from Gem when trying to install the PostgreSQL gem called ‘pg’ and you are using the PostgreSQL App instead of installing PostgreSQL via Brew or some other method, it is because Gem cannot find the PostgreSQL config in the standard locations. To correct this you need to provide Gem with the path to the config file stored within the PostgreSQL App’s internal folder structure.

This can be done as follows:

gem install pg -- --with-pg-config=/Applications/Postgres.app/Contents/Versions/9.4/bin/pg_config

<update: for latest versions of Postgres.app>

gem install pg -- --with-pg-config=/Applications/Postgres.app/Contents/Versions/latest/bin/pg_config

Another way to accomplish this is:

export CONFIGURE_ARGS=”with-pg-include=/Applications/Postgres.app/Contents/Versions/9.4/include/”
gem install pg

Note: the latest version of the PostgreSQL App, at the time of this writing was 9.4, your version may be different. Make sure you change the 9.4 in the config path in the command above to the one you are using or it will not work. You can verify the path by opening Finder, going to the Applications folder, locating Postgres.app, right clicking and selecting ‘show package contents’. This will open up the app’s folder structure in Finder.