【发布时间】:2017-01-31 19:03:39
【问题描述】:
我无法让它工作,我尝试了 StackOverflow 上的几乎所有解决方案,我尝试了:
- 使用自制软件安装/卸载 postgresql
- 指定配置文件
gem install pg -- --with-pg-config=/usr/local/bin/pg_config - 使用 homebrew --force 删除 postgresql 并安装 postgres.app
- 按照以下命令安装 postgres.app 文档:
sudo ARCHFLAGS="-arch x86_64" gem install pg - 指定postgres.app的pg配置文件
sudo ARCHFLAGS="-arch x86_64" gem install pg -- --with-pg-config=/Applications/Postgres.app/Contents/Versions/9.5/bin/pg_config
一切正常,错误总是一样,日志没有显示任何有用的东西......
Estebans-MacBook-Air:collegefundme Esteban.E$ sudo env ARCHFLAGS='-arch x86_64' gem install pg
Building native extensions. This could take a while...
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
current directory: /Users/Esteban.E/.rvm/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/pg-0.19.0/ext
/Users/Esteban.E/.rvm/rubies/ruby-2.3.1/bin/ruby -r ./siteconf20160922-42901-114ix77.rb extconf.rb
checking for pg_config... yes
Using config values from /Applications/Postgres.app/Contents/Versions/latest/bin/pg_config
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.h... yes
checking for pg_config_manual.h... yes
checking for PQconnectdb() in -lpq... yes
checking for PQconnectionUsedPassword()... yes
checking for PQisthreadsafe()... yes
checking for PQprepare()... yes
checking for PQexecParams()... yes
checking for PQescapeString()... yes
checking for PQescapeStringConn()... yes
checking for PQescapeLiteral()... yes
checking for PQescapeIdentifier()... yes
checking for PQgetCancel()... yes
checking for lo_create()... yes
checking for pg_encoding_to_char()... yes
checking for pg_char_to_encoding()... yes
checking for PQsetClientEncoding()... yes
checking for PQlibVersion()... yes
checking for PQping()... yes
checking for PQsetSingleRowMode()... yes
checking for PQconninfo()... yes
checking for PQsslAttribute()... yes
checking for rb_encdb_alias()... yes
checking for rb_enc_alias()... no
checking for rb_thread_call_without_gvl()... yes
checking for rb_thread_call_with_gvl()... yes
checking for rb_thread_fd_select()... yes
checking for rb_w32_wrap_io_handle()... no
checking for rb_str_modify_expand()... yes
checking for rb_hash_dup()... yes
checking for PGRES_COPY_BOTH in libpq-fe.h... yes
checking for PGRES_SINGLE_TUPLE in libpq-fe.h... yes
checking for PG_DIAG_TABLE_NAME in libpq-fe.h... yes
checking for struct pgNotify.extra in libpq-fe.h... yes
checking for unistd.h... yes
checking for inttypes.h... yes
checking for ruby/st.h... yes
checking for C99 variable length arrays... yes
creating extconf.h
creating Makefile
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/Users/Esteban.E/.rvm/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/extensions/x86_64-darwin-15/2.3.0/pg-0.19.0/mkmf.log
current directory: /Users/Esteban.E/.rvm/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/pg-0.19.0/ext
make "DESTDIR=" clean
/Users/Esteban.E/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems.rb:270:in `find_spec_for_exe': can't find gem make (>= 0.a) (Gem::GemNotFoundException)
from /Users/Esteban.E/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems.rb:298:in `activate_bin_path'
from /Users/Esteban.E/.rvm/gems/ruby-2.3.1/bin/make:22:in `<main>'
from /Users/Esteban.E/.rvm/gems/ruby-2.3.1/bin/ruby_executable_hooks:15:in `eval'
from /Users/Esteban.E/.rvm/gems/ruby-2.3.1/bin/ruby_executable_hooks:15:in `<main>'
current directory: /Users/Esteban.E/.rvm/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/pg-0.19.0/ext
make "DESTDIR="
/Users/Esteban.E/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems.rb:270:in `find_spec_for_exe': can't find gem make (>= 0.a) (Gem::GemNotFoundException)
from /Users/Esteban.E/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems.rb:298:in `activate_bin_path'
from /Users/Esteban.E/.rvm/gems/ruby-2.3.1/bin/make:22:in `<main>'
from /Users/Esteban.E/.rvm/gems/ruby-2.3.1/bin/ruby_executable_hooks:15:in `eval'
from /Users/Esteban.E/.rvm/gems/ruby-2.3.1/bin/ruby_executable_hooks:15:in `<main>'
make failed, exit code 1
Gem files will remain installed in /Users/Esteban.E/.rvm/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/pg-0.19.0 for inspection.
Results logged to /Users/Esteban.E/.rvm/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/extensions/x86_64-darwin-15/2.3.0/pg-0.19.0/gem_make.out
我花了很多时间试图自己解决它,任何帮助将不胜感激。
【问题讨论】:
-
你可以试试
gem update --system看看有什么不同吗? -
拉起一个终端会话并运行
brew doctor。我敢打赌它抱怨你的 xcode 命令行工具已经过时了。 -
我做了
gem update --system没有改变日志是一样的,我也做了brew doctor甚至brew update但还是一样=/
标签: ruby-on-rails ruby macos postgresql ruby-on-rails-5