我的PostgreSQL是通过官方的第三方安装包安装的,因此在一般的console中找不到psql之类的命令,如果通过port来安装应该没有这问吧。
对于安装ruby_pg其实是很简单的,只要根据提示把环境变量设置好,基本没什么问题,以下是我的步骤:
[list=1]
[*]export PATH=/Library/PostgreSQL/8.4/bin:$PATH
[*]sudo env ARCHFLAGS='-arch x86_64' gem install pg
[/list]
我的Mac环境是10.6,但是安装成功后,运行rails却出现如下异常:
[quote]dlopen(/Library/Ruby/Gems/1.8/gems/pg-0.9.0/lib/pg_ext.bundle, 9): no suitable image found. Did find:
/Library/Ruby/Gems/1.8/gems/pg-0.9.0/lib/pg_ext.bundle: mach-o, but wrong architecture - /Library/Ruby/Gems/1.8/gems/pg-0.9.0/lib/pg_ext.bundle[/quote]
经Google,好像是跟第三方的dmg安装包有关系的,安装版本好像是32版本,而我系统是64位的,所以在出现了问题。
最后还是通过port install postgresqlxx-server来解决。
通过port安装后,想要做到开机启动,需要
[quote]sudo launchctl load -w /Library/LaunchDaemons/org.macports.postgresql84-server.plist[/quote]
对于安装ruby_pg其实是很简单的,只要根据提示把环境变量设置好,基本没什么问题,以下是我的步骤:
[list=1]
[*]export PATH=/Library/PostgreSQL/8.4/bin:$PATH
[*]sudo env ARCHFLAGS='-arch x86_64' gem install pg
[/list]
我的Mac环境是10.6,但是安装成功后,运行rails却出现如下异常:
[quote]dlopen(/Library/Ruby/Gems/1.8/gems/pg-0.9.0/lib/pg_ext.bundle, 9): no suitable image found. Did find:
/Library/Ruby/Gems/1.8/gems/pg-0.9.0/lib/pg_ext.bundle: mach-o, but wrong architecture - /Library/Ruby/Gems/1.8/gems/pg-0.9.0/lib/pg_ext.bundle[/quote]
经Google,好像是跟第三方的dmg安装包有关系的,安装版本好像是32版本,而我系统是64位的,所以在出现了问题。
最后还是通过port install postgresqlxx-server来解决。
通过port安装后,想要做到开机启动,需要
[quote]sudo launchctl load -w /Library/LaunchDaemons/org.macports.postgresql84-server.plist[/quote]