問題
rails new sample -d postgresql
したときに出たエラー。
Gem::Ext::BuildError: ERROR: Failed to build gem native extension. 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. Could not find gem 'pg (>= 0.18, < 2.0)' in any of the gem sources listed in your Gemfile. Could not find gem 'pg (>= 0.18, < 2.0)' in any of the gem sources listed in your Gemfile.
解決
Rails が postgresql を使うためのプラグインをインストールする。
sudo apt install libpq-dev