whbzrw
Last Updated: February 25, 2016
·
7.816K
· javier_toledo

Install mysql2 gem in Mac OS X with mysql installed via brew

I leave this here for future reference as this is the typical thing you'll forget instantly and need always. If you install MySQL on Mac OS X Mountain Lion via brew, it will install all mysql files here:

/usr/local/opt/mysql/

First of all you need to be sure that your tools are working properly, issue the following command (Brew will alert you on missed or broken compilers, libraries or whatever):

$ brew doctor
Your system is raring to brew.

Do anything brew says that you should do and then install your gem providing the actual mysql directory like this:

$ gem install mysql2 -- --with-mysql-dir=/usr/local/opt/mysql/

Happy coding!

3 Responses
Add your response

4815

Thank's for the reminder, I always rage so much when I have to install this gem on OSX...

over 1 year ago ·
10086

Run bundle install to install missing gems.
i tryed every thing

over 1 year ago ·
14426

I didn't have this issue with mariadb on Mountain Lion.

over 1 year ago ·