The book nicely addresses a potential error installing the pg gem. While obviously the book can’t address every scenario, for anyone that follows the install guide for PostgreSQL 9.5 on Linux, you may still get an error making a new rails app:
Can't find the 'libpq-fe.h header *** 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.
I ran into this error as I do a lot of my dev on cloud dev servers like Cloud9 and Codeanywhere, which spin up VMs with some earlier versions of Postgres installed than called for by David’s text.
To correct the above issue you can run:
sudo apt-get install libpq-dev
Then you should then be able to proceed with:
gem install pg
Hope this helps some/all that might encounter the issue.