Si no tiene Postgres instalado , es posible que desee ir con:
sudo apt-get install postgresql
sudo apt-get install libpq-dev
siguiendo por gem install pg y bundle .
Si tiene postgres instalado y ejecutando gem install pg no funciona, tienes que ejecutar which pg_config para obtener la ruta a su pg_config y ejecute gem install pg -- --with-pg-config= output_from_previous_command .