Updated to Mojave

MacOS 10.14 was released recently and updating the operating system of your development environment can be scary. Typically, I’ll wait some time before I update to ensure I don’t lose productivity. I took the plunge and updated and ran into a strange error where a library was missing.

If you’ve upgrade to Mojave and try to install a gem like mini_racer you will run into problems with a library not being found. This was due to XCode 10 removing the library. However, there is an easy fix to this.

The first indication was that the command line tools were not installed.

Make sure XCode Command Line Tools is installed

xcode-select --install

So then the everything should work correctly…, not quite. Installing mini_racer still failed.

So the error ld: library not found for -lstdc++ is where the actual error lies.

To fix this, open the folder

open /Library/Developer/CommandLineTools/Packages/

Run the package macOS_SDK_headers_for_macOS_10.14.pkg

Then gem install mini_racer works!

This issue may not be only related to mini_racer as it could affect any gem that compiles an extension.