在OSX上安装mysql gem El Capitan,RVM,用于传统的rails应用程序 - MySQL dmg / brew

时间:2016-03-21 22:40:03

标签: mysql ruby-on-rails ruby macos

支持用rails 2.3和ruby 1.8.7编写的遗留应用程序

从OS X 10.9升级到10.11 1-2个月前没有问题,安装了RVM(rvm 1.26.11(最新)),通过brew安装了MySQL 5.6.10,遗留应用程序让mysql gem在其gemset中运行。

试图找到一个运行mysql库文件的anaconda2项目没有找到,我在故障排除时通过brew旧版本卸载(非5.6.10),之后所有rails应用程序都无法启动(缺少mysql依赖项)

我无法使用brew进行任何操作,在使用brew doctor清理所有警告后,我仍无法让MySQL运行(服务器),所以我决定重新开始。

使用ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"

卸载了brew

使用http://downloads.mysql.com/archives/get/file/mysql-5.6.27-osx10.9-x86_64.dmg

重新安装MySQL

能够将数据重新导入服务器并从终端正确连接mysql客户端。

在故障排除期间的某些时候我通过gem uninstall mysql卸载了mysql,现在尝试重新安装gem我收到以下错误:

kh@MBP ~/c/main/code/rails/main % gem install mysql --no-ri --no-rdoc -- --with-mysql-config='/usr/local/mysql/bin/mysql_config'
Building native extensions.  This could take a while...
ERROR:  Error installing mysql:
    ERROR: Failed to build gem native extension.

/Users/kh/.rvm/rubies/ruby-1.8.7-head/bin/ruby extconf.rb --with-mysql-config=/usr/local/mysql/bin/mysql_config
checking for mysql_ssl_set()... no
checking for rb_str_set_len()... no
checking for rb_thread_start_timer()... no
checking for mysql.h... no
checking for mysql/mysql.h... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/Users/kh/.rvm/rubies/ruby-1.8.7-head/bin/ruby
    --with-mysql-config


Gem files will remain installed in /Users/kh/.rvm/gems/ruby-1.8.7-head@ruby-187/gems/mysql-2.9.1 for inspection.
Results logged to /Users/kh/.rvm/gems/ruby-1.8.7-head@ruby-187/gems/mysql-2.9.1/ext/mysql_api/gem_make.out

所有MySQL文件似乎都在正确的位置:

kh@MBP ~/c/main/code/rails/main % ls -l /usr/local/mysql
lrwxr-xr-x  1 kh  staff  27 Mar 18 15:48 /usr/local/mysql -> mysql-5.6.27-osx10.8-x86_64
kh@MBP ~/c/main/code/rails/main % ls -l /usr/local/mysql/bin/*mysql*
-rwxr-xr-x  1 kh  staff      1551 Sep 18  2015 /usr/local/mysql/bin/msql2mysql
-rwxr-xr-x  1 kh  staff   4750576 Sep 18  2015 /usr/local/mysql/bin/mysql
-rwxr-xr-x  1 kh  staff   4838512 Sep 18  2015 /usr/local/mysql/bin/mysql_client_test
-rwxr-xr-x  1 kh  staff  16355200 Sep 18  2015 /usr/local/mysql/bin/mysql_client_test_embedded
-rwxr-xr-x  1 kh  staff      6425 Sep 18  2015 /usr/local/mysql/bin/mysql_config

任何帮助都将不胜感激。

1 个答案:

答案 0 :(得分:1)

我能够通过删除这些RVM红宝石/宝石,升级RVM,重新编译ruby 1.8.7并重新安装我的所有宝石来解决这个问题。似乎是迁移到el capitan问题,旧版本的RVM伪装成特定的mysql问题。