简体   繁体   中英

Error installing pg, requires Ruby version >= 2.2

gem install pg
ERROR:  Error installing pg:
pg requires Ruby version >= 2.2.

This happened after I installed a newer version of PG on my system, so I figure that's fine, what's happening is that it's installing gem pg using the config from the newer version of Postgres that I installed with Homebrew.

So I figure I'll just install the gem using the older version of PG that I had before.

brew install postgresql@9.6
Error: postgresql@9.6 9.6.14 is already installed

Ok perfect! So I then located the pg_config file and am trying to install the gem pg using that config:

gem install pg -- --with-pg-config=/usr/local/Cellar/postgresql@9.6/9.6.14/bin/pg_config

ERROR:  Error installing pg:
pg requires Ruby version >= 2.2.

Yet the error persists... any help appreciated... I've tried uninstalling/reinstalling PG a number of times now...

Also something else that's super frustrating... is there a list somewhere that shows what versions of PG are compatible with which versions of Ruby? I feel like every few months I run into this problem and have this frustrating search happening...

ruby --version
> ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-darwin13.0]
which ruby
> /Users/jamesdong/.rvm/rubies/ruby-2.1.2/bin/ruby
which gem
> /Users/jamesdong/.rvm/rubies/ruby-2.1.2/bin/gem

According to the Changelog , pg 1.2.0 removed support for Ruby <= 2.2. Since you're using 2.1 you'll want to gem install pg -v 1.1.4 , the previous version

(I don't think the actual postgres version you're using should matter as much, 1.1.4 appears to support at least up to 11.x)

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