cd readline-6.0
./configure --prefix=/usr/local
make
sudo make install
tar xvjf ruby-1.8.7-p174.tar.bz2
cd ruby-1.8.7-p174
./configure --prefix=/usr/local/ruby --enable-pthread --with-readline-dir=/usr/local --enable-shared
make
sudo make install
sudo make install-doc
使用ruby -v来确认版本安装正确
/configure --prefix=/usr/local/mysql --with-extra-charsets=complex --enable-thread-safe-client --enable-local-infile --enable-shared --with-plugins=max-no-ndb
make
sudo make install
cd /usr/local/mysql
sudo ./bin/mysql_install_db --user=mysql
sudo chown -R mysql ./var/
mac os x 是靠 launchd 守护进程运行的, 配置文件用的是 PropertyList (XML 格式), 通过观察发现每10秒检查一次, 发现进程不在就启动.
方法是新建 /Library/LaunchDaemons/com.mysql.mysqld.plist 写入如下内容.
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
KeepAlive
Label
com.mysql.mysqld
Program
/usr/local/mysql/bin/mysqld_safe
RunAtLoad
UserName
mysql
WorkingDirectory
/usr/local/mysql
加入守护清单 sudo launchctl load -w /Library/LaunchDaemons/com.mysql.mysqld.plist
查看清单 launchctl list
解除守护 sudo launchctl unload -w /Library/LaunchDaemons/com.mysql.mysqld.plist
tar xzvf mysql-ruby-2.8.1.tar.gz
cd mysql-ruby-2.8.1
ruby extconf.rb --with-mysql-dir=/usr/local/mysql
make
sudo make instal
如果出现类似以下的错误
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... yes
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.
就换用
sudo ruby extconf.rb --with-mysql-config