title: Ubuntu 14.04 - An error occurred while installing pg (0.18.2), and Bundler cannot continue
body: <p>This issue doesn't let me go ahead and I don't know whether it's possible for me to deploy my Rails App ever on Heroku.</p>
  
  <p>When I try <code>bundle install</code> by having <code>gem 'pg'</code> in my Gemfile it gives following error.</p>
  
  <pre><code>An error occurred while installing pg (0.18.2), and Bundler cannot continue.
  </code></pre>
  
  <p><code>Make sure that gem install pg -v '0.18.2' succeeds before bundling.</code></p>
  
  <p>However, when I try <code>sudo gem install pg</code> it says <code>Successfully installed pg-0.18.2
  1 gem installed</code></p>
  
  <p>But when I try to run the app locally or deploy on Heroku it gives me the same error again. By using <code>sqlite3</code> in development mode, all is well, but the same issue occurs on Heroku because Heroku doesn't support sqlite3.</p>