1

我认为这是一个常见问题,但是我在互联网上找到的解决方案对我不起作用。当我在我的 gemfile 中使用此部分运行 bundle install 时

group :production, :staging do
  gem "pg"
end

group :development, :test do
  gem "sqlite3-ruby", :require => "sqlite3"
end

我收到以下错误

creating Makefile

make
compiling gvl_wrappers.c
compiling pg.c
pg.c: In function ‘Init_pg_ext’:
pg.c:375: error: ‘PQPING_OK’ undeclared (first use in this function)
pg.c:375: error: (Each undeclared identifier is reported only once
pg.c:375: error: for each function it appears in.)
pg.c:377: error: ‘PQPING_REJECT’ undeclared (first use in this function)
pg.c:379: error: ‘PQPING_NO_RESPONSE’ undeclared (first use in this function)
pg.c:381: error: ‘PQPING_NO_ATTEMPT’ undeclared (first use in this function)
make: *** [pg.o] Error 1


Gem files will remain installed in /usr/local/rvm/gems/ruby-1.9.3-p194/gems/pg-0.16.0 for inspection.
Results logged to /usr/local/rvm/gems/ruby-1.9.3-p194/gems/pg-0.16.0/ext/gem_make.out

下一步,根据我的发现,是运行locate pg_config,然后将位置放在gem install pg命令行语句之后。但是,我得到了这个错误:

WARNING: The locate database (/var/db/locate.database) does not exist.
To create the database, run the following command:

sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist

Please be aware that the database can take some time to generate; once
the database has been created, this message will no longer appear.

然后我运行sudo命令,并得到这个最终错误....

launchctl: Couldn't stat("/System/Library/LaunchDaemons/com.apple.locate.plis"): No such file or directory
nothing found to load

这是我第一次尝试使用这项技术,对 Mac 来说也是全新的。任何帮助,将不胜感激。谢谢!

编辑

我正在尝试遵循此处有关此错误的建议。

4

1 回答 1

1

看起来尽管您的 gemfile 说了什么,但您正在尝试在本地安装 postgres?

真的,这就是你应该做的。在生产中使用与本地使用不同的数据库确实不是最佳选择。我强烈建议在任何地方都使用 Postgres,并删除 sqlite。

在 Mac 上,最简单的方法是安装Postgress.app

于 2013-08-21T15:00:39.000 回答