开发者

Ruby on Rails: I installed the native pg gem on Mac OS Snow Leopard 10.6.3, but I still get an error "no such file to load -- pg"

I'm using Rails 3.0.1. I installed the native pg gem for postgresql with this command:

$ e开发者_JAVA技巧xport ARCHFLAGS='-arch i386' $ sudo gem install pg -- --with-pg-config=/Library/PostgreSQL/8.4/bin/pg_config

When I run the gem list, I can see that pg 0.9 is installed.

However when I set the postgres database adaptor and re-run the server, I get this error:

no such file to load -- pg

How can I fix this?

Thank you


Open the file named "Gemfile" in the root of your project and add:

gem 'pg'

somewhere in the middle of it (mine is after the line "gem 'rails', '3.0.0'").

Another way to "fix" it is to create a new project with:

rails new <project_name> -d postgresql


I had the same issue with 0.14 and the postgres.app server from heroku. Found that my pg_config file was in the postgres.app directory tree...used that in my config and the pg gem finally installed.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜