Aiker Aiker - 18 days ago 5
Ruby Question

error while creating new app rails with mysql db

Hi everybody i'm new to rails and i installed everything ruby rails mysql and everything was done good and healthy, and when i tried to create a new app 'rails new blog' for example everything done good but whenever i add the '-d mysql' it stucks and give an error knowing that everything is installed good

Aikers-MBP:~ Aiker$ brew install mysql
Warning: mysql-5.7.16 already installed
Aikers-MBP:~ Aiker$

here i tried to install

An error occurred while installing mysql2 (0.4.5), and Bundler cannot continue.
Make sure that

gem install mysql2 -v '0.4.5'
succeeds before bundling.
Aikers-MBP:kar Aiker$ rake db create
Could not find gem 'rails (= 4.2.6)' in any of the gem sources listed in your Gemfile or available on this machine.
Run
bundle install
to install missing gems.
Aikers-MBP:kar Aiker$ gem install mysql2 -v '0.4.5'
Building native extensions. This could take a while...
ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.

Answer

Your system is not able to find lssl library which is present in OpenSSL. To solve this issue you need to run:

brew install openssl

After this try installing mysql2 gem. If this still fails then you might need to reinstall Xcode command line tools by running:

xcode-select --install

Hope this solves your installation issue. :)