环境大概是这样的:

max os 10.10.

rvm 1.26.3

使用 rvm 安装的 ruby 2.1.5

然后我想安装 mysql2gem 包:

gem install mysql2

报以下错误:

Building native extensions. This could take a while...

ERROR: Error installing mysql2:

ERROR: Failed to build gem native extension.

/Users/wjf/.rvm/rubies/ruby-2.1.5/bin/ruby -r ./siteconf20141206-1263-1pbvydq.rb extconf.rb

checking for ruby/thread.h... yes

checking for rb_thread_call_without_gvl() in ruby/thread.h... yes

checking for rb_thread_blocking_region()... yes

checking for rb_wait_for_single_fd()... yes

checking for rb_hash_dup()... yes

checking for rb_intern3()... yes

checking for mysql_query() in -lmysqlclient... no

checking for main() in -lm... yes

checking for mysql_query() in -lmysqlclient... no

checking for main() in -lz... yes

checking for mysql_query() in -lmysqlclient... no

checking for main() in -lsocket... no

checking for mysql_query() in -lmysqlclient... no

checking for main() in -lnsl... no

checking for mysql_query() in -lmysqlclient... no

checking for main() in -lmygcc... no

checking for mysql_query() in -lmysqlclient... 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

--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/wjf/.rvm/rubies/ruby-2.1.5/bin/ruby

--with-mysql-dir

--without-mysql-dir

--with-mysql-include

--without-mysql-include=${mysql-dir}/include

--with-mysql-lib

--without-mysql-lib=${mysql-dir}/lib

--with-mysql-config

--without-mysql-config

--with-mysql-dir

--without-mysql-dir

--with-mysql-include

--without-mysql-include=${mysql-dir}/include

--with-mysql-lib

--without-mysql-lib=${mysql-dir}/lib

--with-mysqlclientlib

--without-mysqlclientlib

--with-mlib

--without-mlib

--with-mysqlclientlib

--without-mysqlclientlib

--with-zlib

--without-zlib

--with-mysqlclientlib

--without-mysqlclientlib

--with-socketlib

--without-socketlib

--with-mysqlclientlib

--without-mysqlclientlib

--with-nsllib

--without-nsllib

--with-mysqlclientlib

--without-mysqlclientlib

--with-mygcclib

--without-mygcclib

--with-mysqlclientlib

--without-mysqlclientlib

extconf failed, exit code 1

Gem files will remain installed in /Users/wjf/.rvm/gems/ruby-2.1.5/gems/mysql2-0.3.17 for inspection.

Results logged to /Users/wjf/.rvm/gems/ruby-2.1.5/extensions/x86_64-darwin-14/2.1.0/mysql2-0.3.17/gem_make.out

wjfdeMBP:~ wjf$ rvm -v

Warning! PATH is not properly set up, '/Users/wjf/.rvm/gems/ruby-2.1.5/bin' is not at first place,

usually this is caused by shell initialization files - check them for 'PATH=...' entries,

it might also help to re-add RVM to your dotfiles: 'rvm get stable --auto-dotfiles',

to fix temporarily in this shell session run: 'rvm use ruby-2.1.5'.

以上错误在 windows/linux 平台上安装 mysql2gem 包的时候也很常见,网上的大部分解决方法都是安装 mysql 数据库及相关的 package,我在 linux 上就是这么解决的,但是现在在 mac 上我不想安装 mysql 数据库,就想搞定这个问题该怎么办?

我在 mysql2 在 github 的主页上看到这样一段:

This gem links against MySQL's libmysqlclient C shared library. You may need to install a package such as libmysqlclient-dev, mysql-devel, or other appropriate package for your system.

于是我开始尝试安装那两个 package,可是都安装失败,网上搜了半天也没有合适的方法,特来此求救!

ruby gem 安装mysql2_如何在不安装 mysql 数据库的情况下安装 mysql2gem 包相关推荐

  1. 64位linux安装mysql数据库吗_Linux下安装Mysql数据库

    在Hadoop开发的时候我们要用到mysql数据库,因此我们有必要学习一下怎样在Linux下安装mysql. 第一步:下载MySQL-client-5.1.73-1.glibc23.x86_64.rp ...

  2. mac下连接mysql数据库_mac 系统下安装MYSQL数据库

    一.安装 比如:Mac OS X ver. 10.7 (x86, 64-bit), DMG Archive 下载完的文件为:mysql-5.6.10-osx10.7-x86_64.dmg 1.点击,安 ...

  3. 64位ubuntu能安装mysql数据库_Ubuntu操作系统下安装MySQL数据库的方法

    安装版本mysql-5.0.40 需编译 下载编译需要的一些工具,这些工具在默认安装的ubuntu上可能没有,需要手动安装 sudo apt-get install g++ gcc make auto ...

  4. 虚拟机上怎么配置mysql数据库_Linux虚拟机下安装配置MySQL

    一.      下载mysql5.7 Linux下载: 输入命令:wget http://mirrors.sohu.com/mysql/MySQL-5.7/mysql-5.7.17-linux-gli ...

  5. windows10 中 python3 离线 安装包,没有 网络 的 情况下 安装 whl包

    windows10中python3离线 安装包,没有 网络 的 情况下 安装 包 下载whl文件 cd python.exe文件路径 pip download 包名 举例 whl 文件 复制到 没有 ...

  6. python3.8.3下载不了nltk_在ubuntu16.04+python3.5情况下安装nltk,以及gensim时pip3安装不成功的解决办法...

    在ubuntu16.04+python3.5情况下安装nltk,以及gensim时pip3安装不成功的解决办法,我刚开始因为不太会用linux命令,所以一直依赖于python 的pip命令,可是怎么都 ...

  7. Mysql数据库有两种安装方法

    Mysql数据库有两种安装方法: 第一种是安装 mysql-5.7.16-winx64,Zip  发杂.麻烦,下载容量大 第二种方式:下载mysql-5.7.13-winx64.msi 内存小,点击自 ...

  8. linux 自动安装mysql数据库_linux系统下源码安装mysql5.6数据库

    linux系统下源码安装mysql5.6数据库 下载mysql数据库相关软件包(百度云盘:http://pan.baidu.com/s/1bnL31c7) 从mysql 5.5版本开始,mysql源码 ...

  9. 断网python第三方库安装_Python离线断网情况下安装numpy、pandas和matplotlib等常用第三方包...

    联网情况下在命令终端CMD中输入"pip install numpy"即可自动安装,pandas和matplotlib同理一样方法进行自动安装. 工作的电脑不能上外网,所以不能通过 ...

最新文章

  1. 自定义窗体设计器-控件测试
  2. LeanCloud学习笔记(1)
  3. javabean总结
  4. 产品经理挑战赛,你敢来吗?
  5. 开发人员眼中最好的代码编辑器是谁?
  6. java读取excel数据的方法是_java怎么读取excel文件里的数据
  7. 【英语学习】【Level 07】U03 Amazing wonders L4 The Qin Dynasty legacy
  8. Windows服务器配置与管理-------DHCP服务器搭建与管理
  9. E-Prime教程 | 打mark标记
  10. win10易升计算机丢失,微软Windows 10易升
  11. 7.nestjs文件上传
  12. 梦网短信接入_阅览版
  13. min函数python_python内置函数之min
  14. 网页版查询mysql数据_网页查询数据库 数据库查询
  15. Python之京东商品秒杀
  16. 影片:天空上尉与明日世界
  17. Opencv求轮廓的中心点坐标
  18. 订单信息表和订单明细表
  19. 2020十大黄金配资交易平台排名
  20. 博士入坑必读-A-Z博士(PhD)顺利毕业必读指南

热门文章

  1. 2021-07-14软件测试实习所学内容
  2. uniapp里css不是识别*,报 error at token “*“
  3. 论文开题报告要查重吗?
  4. 模型评价指标—ROC曲线
  5. 人工智能在石油勘探开发中的应用及发展趋势(总结部分)
  6. MySQL8.0与SQL server 2016的技术区别(一)
  7. 桌面计算机图标怎样优化,桌面图标怎么变小,详细教您电脑桌面图标的太大怎么调小...
  8. 32 《奇特的一生》 -豆瓣评分8.5
  9. 图像处理--最大内接矩形
  10. 百度地图 ( 一 ) 显示地图