前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Leopard下手工安装ruby,rails和mysql

Leopard下手工安装ruby,rails和mysql

作者头像
EltonZheng
发布2021-01-22 07:41:01
6980
发布2021-01-22 07:41:01
举报
  1. 安装readline ftp://ftp.gnu.org/gnu/readline/
代码语言:javascript
复制
cd readline-6.0
./configure --prefix=/usr/local
make
sudo make install
  1. 安装ruby
代码语言:javascript
复制
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来确认版本安装正确

  1. 安装mysql
代码语言:javascript
复制
/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 写入如下内容.

代码语言:javascript
复制
<!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

  1. 安装mysql的c驱动 http://rubyforge.org/fsr/download.php/51087/mysql-ruby-2.8.1.tar.gz
代码语言:javascript
复制
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

如果出现类似以下的错误

代码语言:javascript
复制
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.

就换用

代码语言:javascript
复制
sudo ruby extconf.rb --with-mysql-config

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
相关产品与服务
云数据库 SQL Server
腾讯云数据库 SQL Server (TencentDB for SQL Server)是业界最常用的商用数据库之一,对基于 Windows 架构的应用程序具有完美的支持。TencentDB for SQL Server 拥有微软正版授权,可持续为用户提供最新的功能,避免未授权使用软件的风险。具有即开即用、稳定可靠、安全运行、弹性扩缩等特点。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档