whbzrw
Last Updated: February 25, 2016
·
6.056K
· javier_toledo
Seriousmeh square

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!

Say Thanks
Respond

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
0 wm8ze7nzaiuwgjzkdsr6edfqasuk8jekdynee2cham7nxgxxfxkjxu 6hlruioweesci5wdjhv4x

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

over 1 year ago ·
14426
70b0265140eaff6e312eb3efcff3c195

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

over 1 year ago ·