Installing mysql2 gem for Ruby on Rails with Mac OSX 10.6

后端 未结 12 1123
悲哀的现实
悲哀的现实 2020-12-09 02:56

I am having a problem installing the mysql2 gem.

This comes up when I do gem install mysql2:

Marks-MacBook-Pro:~ Mark$ gem install mysql         


        
12条回答
  •  攒了一身酷
    2020-12-09 03:07

    If you used homebrew to install mysql, brew install mysql,this worked for me:

    gem install mysql2 -v 'x.x.x' -- --with-mysql-config=/usr/local/Cellar/mysql/y.y.y/bin/mysql_config
    

    x.x.x = version of the mysql2 gem you want to install
    y.y.y = the version of mysql you have installed ls /usr/local/Cellar/mysql to find it.

    to get the version of mysql

    brew info mysql                                                                                                                                                                                                     
    mysql: stable 5.7.19 (bottled)
                   ...
    /usr/local/Cellar/mysql/5.7.19 (322 files, 233MB) *
    
                   ...
    

    then if you want to install with bundle:

    bundle config build.mysql --with-mysql-config=/usr/local/Cellar/mysql/y.y.y/bin/mysql_config
    

提交回复
热议问题