近日将 Mac OS 10.7 升级到 OS X 10.8,安装 ruby mysql2 gem 出现下面问题:
Building native extensions. This could take a while...
ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.
checking for rb_thread_blocking_region()... *** 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.
安装 mysql2 的问题很多,大多数都是由于没有配置好 mysql 动态连接库造成的,
但是 checking for rb_thread_blocking_region()
出现这个问题就和 mysql 是没有关系的
这个问题是由于没有安装 Xcode Command Line Tools 的问题,由于升级系统之后之前安装 的 Xcode Command Line Tools 没有了。
重新安装 Xcode Command Line Tools 解决问题。