Error while Installing Nokogiri? mini_portile not available? - ruby

My Local Gem List
bundler (1.6.0)
childprocess (0.5.1)
ffi (1.9.3)
headless (1.0.1)
json (1.8.1)
mini_portile (0.5.3, 0.5.2)
minitest (5.3.1)
multi_json (1.9.0)
rake (10.2.2)
rdoc (4.1.1)
rubyzip (1.1.2)
selenium-webdriver (2.41.0, 2.40.0)
watir-webdriver (0.6.8)
websocket (1.0.7, 1.0.4)
I have also installed libxml2 and libxslt.
It says cannot load mini_portile gem but it shows in the local gem list.
Also I cannot sudo as I don't have the root privileges.
Error Message
Building native extensions. This could take a while...
ERROR: Error installing nokogiri-1.6.1.gem:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9.1 extconf.rb
*** 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.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/bin/ruby1.9.1
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mini_portile (LoadError)
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from extconf.rb:92:in `<main>'
Gem files will remain installed in /home/jotsarup/.gem/gems/nokogiri-1.6.1 for inspection.
Results logged to /home/jotsarup/.gem/gems/nokogiri-1.6.1/ext/nokogiri/gem_make.out

Try to install nokogiri requirements first if u are using Ubuntu.
sudo apt-get install libxslt-dev libxml2-dev
sudo gem install nokogiri
other wise follow this link for Nokogiri Installation

Also try to set GEM_HOME to an absolute path like this:
GEM_HOME=$(pwd)/.gem gem1.9.3 install nokogiri
Using an relative path for GEM_HOME resulted in the mentioned error.

Related

Unable to push Rails Bootstrap project to Heroku

I'm finished up with the railsapps.org tutorial on Rails and Bootstrap. I am not able to deploy it to Heroku though. My code is exactly as the tutorial, and I followed the directions exactly in the "Deploy" chapter, but when I run git push heroku master I get the errors below. Any ideas what is wrong?
Regards,
Jeff
$ git push heroku master
Initializing repository, done.
Counting objects: 136, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (113/113), done.
Writing objects: 100% (136/136), 27.95 KiB | 0 bytes/s, done.
Total 136 (delta 35), reused 0 (delta 0)
-----> Ruby app detected
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-2.1.1
-----> Installing dependencies using 1.5.2
Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
Fetching gem metadata from https://rubygems.org/.......
Fetching additional metadata from https://rubygems.org/..
Using json (1.8.1)
Installing minitest (5.3.3)
Installing rake (10.3.1)
Installing i18n (0.6.9)
Installing thread_safe (0.3.3)
Installing builder (3.2.2)
Installing mime-types (1.25.1)
Installing rack (1.5.2)
Installing erubis (2.7.0)
Installing polyglot (0.3.4)
Installing coffee-script-source (1.7.0)
Installing arel (5.0.1.20140414130214)
Installing execjs (2.0.2)
Installing sass (3.2.19)
Installing multipart-post (2.0.0)
Installing mini_portile (0.5.3)
Installing thor (0.19.1)
Installing oauth (0.4.7)
Installing multi_xml (0.5.5)
Using bundler (1.5.2)
Installing multi_json (1.10.0)
Installing hike (1.2.3)
Installing high_voltage (2.1.0)
Installing tilt (1.4.1)
Installing tzinfo (1.1.0)
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/tmp/build_a6d6f6f3-1b58-4344-8c47-ff3f4229b149/vendor/ruby-2.1.1/bin/ruby extconf.rb
checking for sqlite3.h... no
sqlite3.h is missing. Try 'port install sqlite3 +universal',
'yum install sqlite-devel' or 'apt-get install libsqlite3-dev'
and check your shared library search path (the
location where your sqlite3 shared library is located).
*** 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.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/tmp/build_a6d6f6f3-1b58-4344-8c47-ff3f4229b149/vendor/ruby-2.1.1/bin/ruby
--with-sqlite3-dir
--without-sqlite3-dir
--with-sqlite3-include
--without-sqlite3-include=${sqlite3-dir}/include
--with-sqlite3-lib
--without-sqlite3-lib=${sqlite3-dir}/lib
--enable-local
--disable-local
extconf failed, exit code 1
Gem files will remain installed in /tmp/build_a6d6f6f3-1b58-4344-8c47-ff3f4229b149/vendor/bundle/ruby/2.1.0/gems/sqlite3-1.3.9 for inspection.
Results logged to /tmp/build_a6d6f6f3-1b58-4344-8c47-ff3f4229b149/vendor/bundle/ruby/2.1.0/extensions/x86_64-linux/2.1.0-static/sqlite3-1.3.9/gem_make.out
Installing rack-test (0.6.2)
Installing rdoc (4.1.1)
Installing treetop (1.4.15)
An error occurred while installing sqlite3 (1.3.9), and Bundler cannot continue.
Make sure that `gem install sqlite3 -v '1.3.9'` succeeds before bundling.
Bundler Output: Fetching gem metadata from https://rubygems.org/.......
Fetching additional metadata from https://rubygems.org/..
Using json (1.8.1)
Installing minitest (5.3.3)
Installing rake (10.3.1)
Installing i18n (0.6.9)
Installing thread_safe (0.3.3)
Installing builder (3.2.2)
Installing mime-types (1.25.1)
Installing rack (1.5.2)
Installing erubis (2.7.0)
Installing polyglot (0.3.4)
Installing coffee-script-source (1.7.0)
Installing arel (5.0.1.20140414130214)
Installing execjs (2.0.2)
Installing sass (3.2.19)
Installing multipart-post (2.0.0)
Installing mini_portile (0.5.3)
Installing thor (0.19.1)
Installing oauth (0.4.7)
Installing multi_xml (0.5.5)
Using bundler (1.5.2)
Installing multi_json (1.10.0)
Installing hike (1.2.3)
Installing high_voltage (2.1.0)
Installing tilt (1.4.1)
Installing tzinfo (1.1.0)
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/tmp/build_a6d6f6f3-1b58-4344-8c47-ff3f4229b149/vendor/ruby-2.1.1/bin/ruby extconf.rb
checking for sqlite3.h... no
sqlite3.h is missing. Try 'port install sqlite3 +universal',
'yum install sqlite-devel' or 'apt-get install libsqlite3-dev'
and check your shared library search path (the
location where your sqlite3 shared library is located).
*** 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.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/tmp/build_a6d6f6f3-1b58-4344-8c47-ff3f4229b149/vendor/ruby-2.1.1/bin/ruby
--with-sqlite3-dir
--without-sqlite3-dir
--with-sqlite3-include
--without-sqlite3-include=${sqlite3-dir}/include
--with-sqlite3-lib
--without-sqlite3-lib=${sqlite3-dir}/lib
--enable-local
--disable-local
extconf failed, exit code 1
Gem files will remain installed in /tmp/build_a6d6f6f3-1b58-4344-8c47-ff3f4229b149/vendor/bundle/ruby/2.1.0/gems/sqlite3-1.3.9 for inspection.
Results logged to /tmp/build_a6d6f6f3-1b58-4344-8c47-ff3f4229b149/vendor/bundle/ruby/2.1.0/extensions/x86_64-linux/2.1.0-static/sqlite3-1.3.9/gem_make.out
Installing rack-test (0.6.2)
Installing rdoc (4.1.1)
Installing treetop (1.4.15)
An error occurred while installing sqlite3 (1.3.9), and Bundler cannot continue.
Make sure that `gem install sqlite3 -v '1.3.9'` succeeds before bundling.
!
! Failed to install gems via Bundler.
!
! Detected sqlite3 gem which is not supported on Heroku.
! https://devcenter.heroku.com/articles/sqlite3
!
! Push rejected, failed to compile Ruby app
To git#heroku.com:rails-bootstrap-test.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git#heroku.com:rails-bootstrap-test.git'
According to the book, your Gemfile should look like this:
source 'https://rubygems.org'
ruby '2.1.1'
gem 'rails', '4.1.1'
gem 'sass-rails', '~> 4.0.1'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'spring', group: :development
gem 'activerecord-tableless'
gem 'bootstrap-sass'
gem 'google_drive'
gem 'high_voltage'
gem 'simple_form'
group :development do
gem 'sqlite3'
gem 'better_errors'
gem 'binding_of_caller', :platforms=>[:mri_21]
gem 'quiet_assets'
gem 'rails_layout'
end
group :production do
gem 'pg'
gem 'thin'
gem 'rails_12factor'
end
Make sure gem 'sqlite3' is in the development group. SQLite is not supported on Heroku so you don't want Heroku trying to install it.
This has been a problem for others as well...including myself. I solved it by making sure sqlite3 was only in the development group and pushing to github again to update any changes.
Here are some links where it seems others have commented on this problem:
An error occurred while installing sqlite3 (1.3.7), and Bundler cannot continue
Errors of pushing rails app to Heroku error occurred while installing sqlite3, and Bundler cannot continue
Ok, so weird... I ended up destroying the Heroku app and recreating it. That solved the problem it seems.

bundle/gemfile error installing knife-ec2 plugin

I''m not a ruby guy, trying to install the knife-ec2 plugin for Chef, following the steps here
All is fine until I do
$ bundle install --path vendor
which produces the error below:
Fetching gem metadata from https://rubygems.org/.......
Fetching gem metadata from https://rubygems.org/..
Installing i18n (0.6.9)
Installing multi_json (1.8.4)
Installing activesupport (3.2.16)
Installing addressable (2.3.5)
Installing builder (3.2.2)
Installing gyoku (1.1.1)
Installing mini_portile (0.5.2)
Installing nokogiri (1.6.1) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension
.
/opt/chef/embedded/bin/ruby extconf.rb
Extracting libxml2-2.8.0.tar.gz into tmp//ports/libxml2/2.8.0... OK
Running 'configure' for libxml2 2.8.0... ERROR, review 'tmp//ports/libxml2/2.8.0
/configure.log' to see what happened.
*** 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.
Provided configuration options:
--with-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/opt/chef/embedded/bin/ruby
/home/ubuntu/chef-repo/.chef/vendor/ruby/1.9.1/gems/mini_portile-0.5.2/lib/mini_
portile.rb:265:in `block in execute': Failed to complete configure task (Runtime
Error)
from /home/ubuntu/chef-repo/.chef/vendor/ruby/1.9.1/gems/mini_portile-0.
5.2/lib/mini_portile.rb:257:in `chdir'
from /home/ubuntu/chef-repo/.chef/vendor/ruby/1.9.1/gems/mini_portile-0.
5.2/lib/mini_portile.rb:257:in `execute'
from /home/ubuntu/chef-repo/.chef/vendor/ruby/1.9.1/gems/mini_portile-0.
5.2/lib/mini_portile.rb:65:in `configure'
from /home/ubuntu/chef-repo/.chef/vendor/ruby/1.9.1/gems/mini_portile-0.
5.2/lib/mini_portile.rb:108:in `cook'
from extconf.rb:101:in `block in <main>'
from extconf.rb:119:in `call'
from extconf.rb:119:in `block in <main>'
from extconf.rb:109:in `tap'
from extconf.rb:109:in `<main>'
Gem files will remain installed in /home/ubuntu/chef-repo/.chef/vendor/ruby/1.9.
1/gems/nokogiri-1.6.1 for inspection.
Results logged to /home/ubuntu/chef-repo/.chef/vendor/ruby/1.9.1/gems/nokogiri-1
.6.1/ext/nokogiri/gem_make.out
An error occured while installing nokogiri (1.6.1), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.6.1'` succeeds before bundling.
Please let me know if posting additional files or console output would help.
You need to install libxml. The stacktrace shows you're on Ubuntu, so:
sudo apt-get install libxml2
See the Nokogiri readme for more information.

Can't run ruby app on local using foreman

I have an application named "Aadvisor", when i try to run this application on local, i do foreman start like below:
pallav#pallav-System-Product-Name:~/Workspace/Aadvisor$ foreman start
14:21:28 web.1 | started with pid 14635
14:21:28 web.1 | bundler: command not found: rackup
14:21:28 web.1 | Install missing gem executables with `bundle install`
14:21:29 web.1 | exited with code 127
14:21:29 system | sending SIGTERM to all processes
SIGTERM received
Then i do 'bundle install' :
pallav#pallav-System-Product-Name:~/Workspace/Aadvisor$ bundle install
Fetching gem metadata from http://rubygems.org/.........
Fetching additional metadata from http://rubygems.org/..
Resolving dependencies...
Using addressable (2.3.5)
Using backports (3.4.0)
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9.1 extconf.rb
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mkmf (LoadError)
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from extconf.rb:13:in `<main>'
Gem files will remain installed in /home/pallav/Workspace/Aadvisor/vendor/bundle/ruby/1.9.1/gems/bcrypt-ruby-3.1.2 for inspection.
Results logged to /home/pallav/Workspace/Aadvisor/vendor/bundle/ruby/1.9.1/gems/bcrypt-ruby-3.1.2/ext/mri/gem_make.out
An error occurred while installing bcrypt-ruby (3.1.2), and Bundler cannot continue.
Make sure that `gem install bcrypt-ruby -v '3.1.2'` succeeds before bundling.
Then i simply do gem install bcrypt-ruby -v '3.1.2', as below:
pallav#pallav-System-Product-Name:~/Workspace/Aadvisor$ gem install bcrypt-ruby -v '3.1.2'
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions into the /var/lib/gems/1.9.1 directory.
Then using 'sudo' sudo gem install bcrypt-ruby -v '3.1.2', as below:
pallav#pallav-System-Product-Name:~/Workspace/Aadvisor$ sudo gem install bcrypt-ruby -v '3.1.2'
[sudo] password for pallav:
Building native extensions. This could take a while...
ERROR: Error installing bcrypt-ruby:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9.1 extconf.rb
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mkmf (LoadError)
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from extconf.rb:13:in `<main>'
Gem files will remain installed in /var/lib/gems/1.9.1/gems/bcrypt-ruby-3.1.2 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/bcrypt-ruby-3.1.2/ext/mri/gem_make.out
I checked the error log here:
pallav#pallav-System-Product-Name:~/Workspace/Aadvisor$ /var/lib/gems/1.9.1/gems/bcrypt-ruby-3.1.2/ext/mri/gem_make.out
bash: /var/lib/gems/1.9.1/gems/bcrypt-ruby-3.1.2/ext/mri/gem_make.out: Permission denied
My ruby version is :
pallav#pallav-System-Product-Name:~/Workspace/Aadvisor$ ruby -v
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]
My Gem file is:
source "http://rubygems.org"
gem "rack"
gem "sinatra"
gem "sinatra-contrib"
gem "json"
gem "will_paginate"
gem 'will_paginate-bootstrap'
gem "thin"
#gem "shotgun"
gem 'pg'
gem "data_mapper"
gem "dm-postgres-adapter"
gem "dm-validations"
I did installed rvm \curl -sSL https://get.rvm.io | bash and also did sudo apt-get install ruby1.9.1-dev after that i tried again doing bundle install and i get this:
pallav#pallav-System-Product-Name:~/Workspace/Aadvisor$ bundle install
Fetching source index from http://rubygems.org/
Resolving dependencies................................
Using addressable (2.3.5)
Using backports (3.4.0)
Installing bcrypt-ruby (3.1.2)
Installing daemons (1.1.9)
Installing dm-core (1.2.1)
Installing dm-aggregates (1.2.0)
Installing dm-constraints (1.2.0)
Installing dm-migrations (1.2.0)
Installing fastercsv (1.5.5)
Installing json (1.8.1)
Installing json_pure (1.8.1)
Installing multi_json (1.8.4)
Installing dm-serializer (1.2.2)
Installing dm-timestamps (1.2.0)
Installing dm-transactions (1.2.0)
Installing stringex (1.5.1)
Installing uuidtools (2.1.4)
Installing dm-types (1.2.2)
Installing dm-validations (1.2.0)
Installing data_mapper (1.2.0)
Installing data_objects (0.10.13)
Installing dm-do-adapter (1.2.0)
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9.1 extconf.rb
checking for main() in -lpq... no
checking for main() in -llibpq... no
*** 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.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/bin/ruby1.9.1
--with-pgsql-server-dir
--without-pgsql-server-dir
--with-pgsql-server-include
--without-pgsql-server-include=${pgsql-server-dir}/include
--with-pgsql-server-lib
--without-pgsql-server-lib=${pgsql-server-dir}/lib
--with-pgsql-client-dir
--without-pgsql-client-dir
--with-pgsql-client-include
--without-pgsql-client-include=${pgsql-client-dir}/include
--with-pgsql-client-lib
--without-pgsql-client-lib=${pgsql-client-dir}/lib
--with-pqlib
--without-pqlib
--with-libpqlib
--without-libpqlib
Could not find PostgreSQL build environment (libraries & headers): Makefile not created
Gem files will remain installed in /home/pallav/Workspace/Aadvisor/vendor/bundle/ruby/1.9.1/gems/do_postgres-0.10.13 for inspection.
Results logged to /home/pallav/Workspace/Aadvisor/vendor/bundle/ruby/1.9.1/gems/do_postgres-0.10.13/ext/do_postgres/gem_make.out
An error occurred while installing do_postgres (0.10.13), and Bundler cannot continue.
Make sure that `gem install do_postgres -v '0.10.13'` succeeds before bundling.
I also tried installing gem install do_postgres -v '0.10.13' like this :
pallav#pallav-System-Product-Name:~/Workspace/Aadvisor$ sudo gem install do_postgres -v '0.10.13'
Fetching: data_objects-0.10.13.gem (100%)
Fetching: do_postgres-0.10.13.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing do_postgres:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9.1 extconf.rb
checking for main() in -lpq... no
checking for main() in -llibpq... no
*** 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.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/bin/ruby1.9.1
--with-pgsql-server-dir
--without-pgsql-server-dir
--with-pgsql-server-include
--without-pgsql-server-include=${pgsql-server-dir}/include
--with-pgsql-server-lib
--without-pgsql-server-lib=${pgsql-server-dir}/lib
--with-pgsql-client-dir
--without-pgsql-client-dir
--with-pgsql-client-include
--without-pgsql-client-include=${pgsql-client-dir}/include
--with-pgsql-client-lib
--without-pgsql-client-lib=${pgsql-client-dir}/lib
--with-pqlib
--without-pqlib
--with-libpqlib
--without-libpqlib
Could not find PostgreSQL build environment (libraries & headers): Makefile not created
Gem files will remain installed in /var/lib/gems/1.9.1/gems/do_postgres-0.10.13 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/do_postgres-0.10.13/ext/do_postgres/gem_make.out
Finally i checked the result as :
pallav#pallav-System-Product-Name:~/Workspace/Aadvisor$ /var/lib/gems/1.9.1/gems/do_postgres-0.10.13/ext/do_postgres/gem_make.out
bash: /var/lib/gems/1.9.1/gems/do_postgres-0.10.13/ext/do_postgres/gem_make.out: Permission denied
What probably could be the error.

Error installing pg gem

In order to deploy my rails app to heroku, I made change to my Gemfile by adding
gem 'pg'
Once I did
bundle install
I am getting following error -
Fetching gem metadata from https://rubygems.org/...........
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies...
Using rake (10.1.1)
Using i18n (0.6.9)
Using minitest (4.7.5)
Using multi_json (1.8.2)
Using atomic (1.1.14)
Using thread_safe (0.1.3)
Using tzinfo (0.3.38)
Using activesupport (4.0.0)
Using builder (3.1.4)
Using erubis (2.7.0)
Using rack (1.5.2)
Using rack-test (0.6.2)
Using actionpack (4.0.0)
Using mime-types (1.25.1)
Using polyglot (0.3.3)
Using treetop (1.4.15)
Using mail (2.5.4)
Using actionmailer (4.0.0)
Using activemodel (4.0.0)
Using activerecord-deprecated_finders (1.0.3)
Using arel (4.0.1)
Using activerecord (4.0.0)
Using bundler (1.3.5)
Using coffee-script-source (1.6.3)
Using execjs (2.0.2)
Using coffee-script (2.2.0)
Using thor (0.18.1)
Using railties (4.0.0)
Using coffee-rails (4.0.1)
Using hike (1.2.3)
Using jbuilder (1.5.3)
Using jquery-rails (3.0.4)
Using json (1.8.1)
Installing pg (0.17.1)
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/Users/aniruddhabarapatre1/.rvm/rubies/ruby-2.0.0-p247/bin/ruby extconf.rb
checking for pg_config... no
No pg_config... trying anyway. If building fails, please try again with
--with-pg-config=/path/to/pg_config
checking for libpq-fe.h... no
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.
Provided configuration options:
--with-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/Users/aniruddhabarapatre1/.rvm/rubies/ruby-2.0.0-p247/bin/ruby
--with-pg
--without-pg
--with-pg-config
--without-pg-config
--with-pg_config
--without-pg_config
--with-pg-dir
--without-pg-dir
--with-pg-include
--without-pg-include=${pg-dir}/include
--with-pg-lib
--without-pg-lib=${pg-dir}/
Gem files will remain installed in /Users/aniruddhabarapatre1/.rvm/gems/ruby-2.0.0-p247/gems/pg-0.17.1 for inspection.
Results logged to /Users/aniruddhabarapatre1/.rvm/gems/ruby-2.0.0-p247/gems/pg-0.17.1/ext/gem_make.out
An error occurred while installing pg (0.17.1), and Bundler cannot continue.
Make sure that `gem install pg -v '0.17.1'` succeeds before bundling.
I assumed I didn't had PostgreSQL installed on my computer and hence downloaded it to no use.
I tried couple of other options and ran following command with similar errors again.
gem install pg
Got this thing figured out.
Since I had PostgreSQL.app already installed. Gave following command -
gem install pg -- --with-pg-config=/Applications/Postgres93.app/Contents/MacOS/bin/pg_config
This works => env ARCHFLAGS="-arch x86_64" gem install pg -- --with-pg-config=/Applications/Postgres.app/Contents/Versions/9.4/bin/pg_config
Do you have postgres development libraries?
I uninstalled then reinstalled postgresql. Then I installed pg -v '0.17.1'. After that I ran bundle. It worked.

An error occurred while installing pg (0.15.1) ; PostgreSQL on Mac Installation Error: no pg_config, gem native extension build failure

I have OSX 10.6.8 and am trying to install PostgreSQL 9.2 on my device. I used the graphical installer available on their website, and set up the software, without using stack builder at the end to additionally configure other functions.
When I load my Rails file and bundle install I encounter the following error:
Fetching gem metadata from https://rubygems.org/........
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies...
Using rake (10.1.0)
Using i18n (0.6.4)
Using minitest (4.7.5)
Using multi_json (1.7.7)
Using atomic (1.1.10)
Using thread_safe (0.1.0)
Using tzinfo (0.3.37)
Using activesupport (4.0.0)
Using builder (3.1.4)
Using erubis (2.7.0)
Using rack (1.5.2)
Using rack-test (0.6.2)
Using actionpack (4.0.0)
Using formatador (0.2.4)
Using rb-fsevent (0.9.3)
Using rb-inotify (0.9.0)
Using rb-kqueue (0.2.0)
Using listen (1.2.2)
Using lumberjack (1.0.4)
Using method_source (0.8.1)
Using slop (3.4.5)
Using pry (0.9.12.2)
Using guard (1.8.1)
Using rspec-core (2.13.1)
Using rspec-expectations (2.13.0)
Using turbolinks (1.2.0)
Using jquery-turbolinks (1.0.0)
Using jquery-ui-rails (4.0.3)
Using json (1.8.0)
Using kaminari (0.14.1)
Using nested_form (0.3.2)
Installing pg (0.15.1)
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/usr/local/rvm/rubies/ruby-1.9.3-p448/bin/ruby extconf.rb
checking for pg_config... no
No pg_config... trying anyway. If building fails, please try again with
--with-pg-config=/path/to/pg_config
checking for libpq-fe.h... no
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.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/local/rvm/rubies/ruby-1.9.3-p448/bin/ruby
--with-pg
--without-pg
--with-pg-dir
--without-pg-dir
--with-pg-include
--without-pg-include=${pg-dir}/include
--with-pg-lib
--without-pg-lib=${pg-dir}/lib
--with-pg-config
--without-pg-config
--with-pg_config
--without-pg_config
Gem files will remain installed in /usr/local/rvm/gems/ruby-1.9.3-p448/gems/pg-0.15.1 for inspection.
Results logged to /usr/local/rvm/gems/ruby-1.9.3-p448/gems/pg-0.15.1/ext/gem_make.out
An error occurred while installing pg (0.15.1), and Bundler cannot continue.
Make sure that `gem install pg -v '0.15.1'` succeeds before bundling.
I have tried gem install pg -- --with-pg-config=/Library/PostgreSQL/9.1/bin/pg_config , all of the error message suggestions I've gotten and the solutions here. I have also tried re-installing Postgres, locating the appropriate config path, and locating the mfmk.log file the error message mentions (but the file doesn't exist on my computer). Furthermore, under my apps/PostgreSQL, there is a "Reload Configuration" application that, when I run, says Server signaled.
Anyone know what I should do? I was going to try Homebrew, but I found it quite strange that the installer itself wouldn't be able to produce functioning software.
If you are on a Mac try:
ARCHFLAGS="-arch x86_64" gem install pg
This worked for me (The brew installer told me this... gotta love brew)

Resources