[Ruby on Rails] bundle install fails "An error occurred while installing pg (1.2.3), and Bundler cannot continue."

error contents

I got the following error when I did bundle install.

An error occurred while installing pg (1.2.3), and Bundler cannot continue.
Make sure that `gem install pg -v '1.2.3' --source 'https://rubygems.org/'` succeeds before bundling.

As told

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

I did, but the error doesn't go away ...

environment

ruby : 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin19] Rails : 6.0.3.4

solution

brew install postgresql

It seems that postgresql needs to be prepared locally in order to install gem pg. After this, I re-bundle install and it was fixed!

Recommended Posts

[Ruby on Rails] bundle install fails "An error occurred while installing pg (1.2.3), and Bundler cannot continue."
Bundle install, rails command execution error An error occurred while installing nokogiri (1.10.10), and Bundler cannot continue. Make sure that `gem install nokogiri -v '1.10.10' --source' https: // rubygems. org /'`successs before bundling. Solution
I get an error with bundle install and puma cannot be installed.
I don't see an error in Rails bundle install ... the solution
[Ruby on Rails] yarn install --check-files
Installing Ruby + Rails on Ubuntu 18.04 (rbenv)
What to do if you can't bundle update and bundle install after installing Ruby 3.0.0 in the Rails tutorial
[Rails 6] MySQL 2 cannot be bundle install
Add gem'rails-i18n','~> 6.0.0' and what to do if bundle install gives an error
Copying the repository and getting a mysql2 error on the first bundle install
[Ruby on Rails] Creating an inquiry form
[Ruby on Rails] About bundler (for beginners)
[Ruby on Rails] Add and delete tags and display (success / error) messages using ajax.