Blog

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 doctor error –

When setting up Flutter for development on macOS Big Sur, you may run into the following error if you are managing Ruby using RVM and trying to install Cocoapods via Gem.

[!] Xcode - develop for iOS and macOS (Xcode 12.2)
    ✗ CocoaPods installed but not working.
        You appear to have CocoaPods installed but it is not working.
        This can happen if the version of Ruby that CocoaPods was installed with is different from the one being used to invoke it.
        This can usually be fixed by re-installing CocoaPods. For more info, see https://github.com/flutter/flutter/issues/14293.
      To re-install CocoaPods, run:
        sudo gem install cocoapods

Flutter has an issue when RVM is being used to manage Ruby and Gem and Cocoapods is installed using Gem. It seems to detect that Cocoapods is installed but cannot properly access/execute it due to a Ruby version mismatch at execution.

To correct this I removed Cocoapods from Gem using ‘sudo gem uninstall cocoapods’ and I reinstalled Cocoapods using Brew instead:

> brew install cocoapods
> brew link --overwrite cocoapods

With that, ‘flutter doctor’ can now properly access/execute cocoapods.

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 1.22.4, on macOS 11.0.1 20B29 darwin-x64, locale en-US)

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
[✓] Xcode - develop for iOS and macOS (Xcode 12.2)

macOS Big Sur: Flutter doctor error – Bad state: Future already completed

If you are running into issues getting Flutter setup for development on macOS Big Sur and you are getting the following error when running the ‘flutter doctor’ command and you have Avast Antivirus running, there is a good chance Avast is your problem.

Error Message:

❯ flutter doctor -v
[✓] Flutter (Channel stable, 1.22.4, on macOS 11.0.1 20B29 darwin-x64, locale en-US)
    • Flutter version 1.22.4 at /Users/<user>/dev/env/flutter
    • Framework revision 1aafb3a8b9 (4 days ago), 2020-11-13 09:59:28 -0800
    • Engine revision 2c956a31c0
    • Dart version 2.10.4

⣽Unhandled exception:
Bad state: Future already completed
#0      _AsyncCompleter.complete (dart:async/future_impl.dart:43:31)
#1      _NativeSocket.startConnect.<anonymous closure>.connectNext.<anonymous closure> (dart:io-patch/socket_patch.dart:682:23)
#2      _NativeSocket.issueWriteEvent.issue (dart:io-patch/socket_patch.dart:1102:14)
#3      _NativeSocket.issueWriteEvent (dart:io-patch/socket_patch.dart:1109:12)
#4      _NativeSocket.multiplex (dart:io-patch/socket_patch.dart:1130:11)
#5      _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12)

Once I uninstalled Avast, the ‘flutter doctor’ command works without issue.

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”

macOS Big Sur: RVM error running ‘__rvm_make -j4’

If you are runnig into issues installing RVM and Ruby on macOS Big Sur and you get the following “error running ‘__rvm_make -j4′”. Here is a solution to get Ruby installed under RVM.

brew install homebrew/portable-ruby/portable-openssl
rvm reinstall ruby-2.3.1 --with-openssl-dir=/usr/local/opt/portable-openssl/

I have not spent time diving into the root cause of the error, just glad someone had a solution to the problem. Here is the original Github issue report that had a solution that worked: https://github.com/rvm/rvm/issues/4484.

Tech Tutorial: Learning React.js for Single-Page Web Applications – Complete Playlist

As websites and web applications have become more complex to meet both creator and user demands, the need for more dynamic and fluid web pages (user interfaces) has grown. To meet this need, several front-end JavaScript libraries have emerged and React.js is one of the most used.

In this video, we introduce you to React.js and how it is used to build fluid and dynamic user interfaces that provide a more improved and complex user experience.


Personal Recommendation (unpaid)
Programming and software development are awesome! Being that you are learning along with me, there is a really good chance you can make this a career. Based on my own life experience, let me suggest to you that you go get a Computer Science degree from Neumont College of Computer Science and kick your life into hyper-drive.

visit: https://www.neumont.edu/