Jared Selcoe


10 Experience
0 Lessons Completed
0 Questions Solved


Posted in Setup MacOS 10.15 Catalina Discussion

I ran into problems when installing the ruby mysql2 0.5.3 gem after running rails new myapp -d mysql. The sudo installer -pkg ... command suggested in the tutorial did not work. I received the error message:

Error - the package path specified was invalid: '/Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg'

Looking at the CommandLineTools folder revealed the issue, as I don't even have the Packages folder in it. I'm on OSX 10.15 (Catalina) for the record.

I also tried to install the gem on its own as per the CLI recommendations with gem install mysql2. That also failed in the same way as the original rails ... command.

The solution for me ended up being gem install mysql2 --source 'https://rubygems.org/' -- --with-ldflags=-L/usr/local/opt/openssl/lib --with-cppflags=-I/usr/local/opt/openssl/include. Ran that to install the gem individually then was able to successfully run the rails ... command.

Solution courtesy of https://stackoverflow.com/a/57344765/7465982.