简体   繁体   中英

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:

$ export 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM