The problem that Mysql cannot be installed using Gem in Mac OS is that when Mysql is installed using Gem in Mac OS, the following error occurs: www.2cto.com Java code Building native extensions. this cocould take a while... ERROR: Error installing mysql: ERROR: Failed to build gem native extension. /System/Library/Frameworks/Ruby. framework/Versions/1.8/usr/bin/ruby extconf. rb 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 seems to be caused by the lack of some files, so I looked at/System/Library/Frameworks/Ruby. framework/Versions/1.8/usr/bin/ruby extconf. rb found extconf. rb seems to require Mysql PATH, so execute: Java code export PATH = $ PATH:/usr/local/mysql/bin sudo gem install mysql-V' 2. 8.1 'problem solved: www.2cto.com Java code Building native extensions. this cocould take a while... successfully installed mysql-2.8.1 1 gem installed Installing ri documentation for mysql-2.8.1... installing RDoc documentation for mysql-2.8.1...