Ruby 安装pg时出现问题

Ruby 安装pg时出现问题,ruby,rubygems,bundle,homebrew,pg,Ruby,Rubygems,Bundle,Homebrew,Pg,我一直在尝试安装一个api,上面写着使用 bundle install rails s 但当我进行捆绑时,会出现以下错误: An error occurred while installing pg (0.18.1), and Bundler cannot continue. Make sure that `gem install pg -v '0.18.1' --source 'https://rubygems.org/'`succeeds before bundling. 但当我运行g

我一直在尝试安装一个api,上面写着使用

bundle install
rails s
但当我进行捆绑时,会出现以下错误:

An error occurred while installing pg (0.18.1), and Bundler cannot 
continue. Make sure that `gem install pg -v '0.18.1' --source 'https://rubygems.org/'`succeeds before bundling.
但当我运行gem install命令时,我得到了以下结果:

错误:安装pg时出错: 错误:无法生成gem本机扩展

current directory: /Library/Ruby/Gems/2.3.0/gems/pg-0.18.1/ext /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby -r ./siteconf20191018-63874-el2g8s.rb extconf.rb checking for pg_config... yes Using config values from /usr/local/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... no
checking for PQconnectdb() in -llibpq... no
checking for PQconnectdb() in -lms/libpq... no
Can't find the PostgreSQL client library (libpq)
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers.  Check the mkmf.log file for more details. You may need configuration options.
mkmf.log文件显示:

ld: warning: directory not found for option '-L/BuildRoot/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.Internal.sdk/usr/local/libressl/lib'
我真的不知道从哪里开始,因为我已经在网上阅读了大量其他指南,它们要么不起作用,要么导致新的错误。

。这将处理任何依赖项,如Xcode的命令行工具。在终端中运行此命令以安装brew:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew成功安装后,安装PostgreSQL时使用:

brew install postgresql
然后重试:

gem install pg -v '0.18.1' --source 'https://rubygems.org/'
请注意,指定的gem版本已过期近五年。

。这将处理任何依赖项,如Xcode的命令行工具。在终端中运行此命令以安装brew:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew成功安装后,安装PostgreSQL时使用:

brew install postgresql
然后重试:

gem install pg -v '0.18.1' --source 'https://rubygems.org/'

请注意,指定的gem版本已过期五年。

您安装了xcode吗?如果没有,您需要。您安装了xcode吗?如果不是,你需要。你不需要先做
xcode-select--install
然后再安装homebrew吗?前几天在新安装的Catalina上,它为我自动完成了这项工作。你不需要先做
xcode-select--install
然后再安装homebrew吗?前几天在新安装的Catalina上,它做到了这一点对我来说是自动的。