sudo gem install pg -v '0.18.4' 在 macos sierra high (RoR) 上不起作用

sudo gem install pg -v '0.18.4' does not work on macos sierra high (RoR)

我很难尝试 gem 在 rails "bundle install" 应用程序上安装我的 ruby 所需的 pg -v '0.18.4' 3 年前。

sudo gem install pg -v '0.18.4'

投诉如下:

conftest.c:15:13: error: conflicting types for 'PQconnectdb'
extern void PQconnectdb();

完全执行错误https://gist.github.com/axilaris/f521685f4e5c7a8e5653bf672af1efa7

mkmf.log - https://gist.github.com/axilaris/2e4cf2729b34d751c1ce76b046a0b21c

我的环境如下:

Postgres 9.4.0.1
MacOs Sierra High 10.13.1

$ ruby -v
ruby 2.3.3p222 (2016-11-21 revision 56859) [universal.x86_64-darwin17]

$ rails -v
Rails 5.1.4

我尝试安装 brew 安装 libpqxx 没用

这里有一些相关的Whosebug:

Can't find the 'libpq-fe.h header when trying to install pg gem

Impossible to Install PG gem on my mac with Mavericks

我想确保安装 - sudo gem install pg -v '0.18.4'。因为在生产中它也应该是 运行。我不想破坏生产 ubuntu 服务器中 运行 的任何内容。目前对于这个问题,我正在我的 mac 上设置环境以进行开发以尝试修复代码。

仅供参考,我试过 2 macs。一个升级到 sierra high 的原始开发 mac,另一个是新安装的 sierra high 的新格式 mac。

试试这个

ARCHFLAGS="-arch x86_64" bundle install

对于 RMagick 执行此操作

brew install imagemagick@6
brew link --force imagemagick@6

如果在安装 rmagick 时出现任何错误,请告诉我。