I'm in the final lesson of my first RoR tutorial and I'm being directed to open up terminal and input install bundle
The result:
tonys-mbp:crumblr Tony-MBP$ bundle install
Fetching gem metadata from https://rubygems.org/..........
Resolving dependencies...
Using rake 10.3.2
Using i18n 0.6.11
Using json 1.8.1
Using minitest 5.4.2
Using thread_safe 0.3.4
Using tzinfo 1.2.2
Using activesupport 4.1.6
Using builder 3.2.2
Using erubis 2.7.0
Using actionview 4.1.6
Using rack 1.5.2
Using rack-test 0.6.2
Using actionpack 4.1.6
Using mime-types 2.4.1
Using mail 2.6.1
Using actionmailer 4.1.6
Using activemodel 4.1.6
Using arel 5.0.1.20140414130214
Using activerecord 4.1.6
Using bundler 1.7.3
Using coffee-script-source 1.8.0
Using execjs 2.2.1
Using coffee-script 2.3.0
Using thor 0.19.1
Using railties 4.1.6
Using coffee-rails 4.0.1
Using hike 1.2.3
Using multi_json 1.10.1
Using jbuilder 2.2.2
Using jquery-rails 3.1.2
/Users/Tony-MBP/.rvm/gems/ruby-2.1.3/gems/bundler-1.7.3/lib/bundler.rb:302: warning: Insecure world writable dir /usr/local in PATH, mode 040777
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/Users/Tony-MBP/.rvm/rubies/ruby-2.1.3/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/Tony-MBP/.rvm/rubies/ruby-2.1.3/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}/lib
extconf failed, exit code 1
Gem files will remain installed in /Users/Tony-MBP/.rvm/gems/ruby-2.1.3/gems/pg-0.17.1 for inspection.
Results logged to /Users/Tony-MBP/.rvm/gems/ruby-2.1.3/extensions/x86_64-darwin-13/2.1.0/pg-0.17.1/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.
So I tried installing pg so I can continue on with Bundler; however, I get this error when I input: gem install pg -v '0.17.1':
Result:
tonys-mbp:crumblr Tony-MBP$ gem install pg
Building native extensions. This could take a while...
/Users/Tony-MBP/.rvm/rubies/ruby-2.1.3/lib/ruby/2.1.0/rubygems/ext/builder.rb:73: warning: Insecure world writable dir /usr/local in PATH, mode 040777
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
/Users/Tony-MBP/.rvm/rubies/ruby-2.1.3/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/Tony-MBP/.rvm/rubies/ruby-2.1.3/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}/lib
extconf failed, exit code 1
Gem files will remain installed in /Users/Tony-MBP/.rvm/gems/ruby-2.1.3/gems/pg-0.17.1 for inspection.
Results logged to /Users/Tony-MBP/.rvm/gems/ruby-2.1.3/extensions/x86_64-darwin-13/2.1.0/pg-0.17.1/gem_make.out
Can anyone please help identify why both of these are failing? Thanks for helping out a complete newb in his developer infancy.
Edit:
After trying the suggested code from #Lidan, this is what I get:
Building native extensions with: '--with-pg-config=/Applications/Postgres.app/Contents/MacOS/bin/pg_config'
This could take a while...
/Users/Tony-MBP/.rvm/rubies/ruby-2.1.3/lib/ruby/2.1.0/rubygems/ext/builder.rb:73: warning: Insecure world writable dir /usr/local in PATH, mode 040777
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
This error message states that pg_config is missing and you should pass in the path the pg_config file, most of the time this file will be in your Postgres installation directory.
However, if you're using Postgres.app to run a local Postgres server while doing development work, this file will be missing because postgres.app is a self contained app.
try reinstalling the gem using:
$ gem install pg -- --with-pg-config=/Applications/Postgres.app/Contents/MacOS/bin/pg_config
Building native extensions with: '--with-pg-config=/Applications/Postgres.app/Contents/MacOS/bin/pg_config'
This could take a while...
Successfully installed pg-0.17.1
1 gem installed
I recommend using Postgres.app because when you install postgres via brew install postgresql, the postgres service is running in the background and utilizes memory, even when you're not developing or using the database. Postgres.app is more efficient for development environments under OSX, in my experience.
After further research, OS X Mavericks wasn't playing nicely with pg or bundle gems.
The four-step fix that worked for me:
brew update
brew install postgresql
gem install pg
bundle install
Related
Iam trying to set up a rails project which has ruby 2.2.3 and rails version 4.2.7.1. It uses PostgreSQL as the database . I can see gem 'pg' entry in the GemFile. I did bundle install to install the dependencies, but when it came to installing pg gem , it is giving me the following error. I dont have postgreSQL installed on my ubuntu 18.04 LTS system. Could this be the reason why iam getting this error. Please help. Error that i am getting:
**
**Fetching pg 1.2.3
Installing pg 1.2.3 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /home/pc-123/.rvm/gems/ruby-2.2.3/gems/pg-1.2.3/ext
/home/pc-123/.rvm/rubies/ruby-2.2.3/bin/ruby -I /home/pc-123/.rvm/rubies/ruby-2.2.3/lib/ruby/site_ruby/2.2.0 -r ./siteconf20200822-841-6si3xn.rb
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=/home/pc-123/.rvm/rubies/ruby-2.2.3/bin/$(RUBY_BASE_NAME)
--with-pg
--without-pg
--enable-windows-cross
--disable-windows-cross
--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}/lib
**
You must install the libpq-dev package. You are using Ubuntu so:
sudo apt install libpq-dev
It would be smart to have PostGreSQL installed.
This depends on what Ruby version is your interpreter using. A mismatch there and you can run into problems. Using the same version will fix your issue.
Ive been trying out Rubymine for a small rails project and would really like the debugging to work.
The project is a rails API and uses Postgres running on my Mac with El Capitan.
The problem i have is Rubymine is complaining of 'No Rails found in SDK'
I thought the solution to this was to run bundle install from the Rubymine menu.
However that consistently fails at installing pg:
....
Using hashie 3.4.3
Using multi_json 1.11.2
Using multi_xml 0.5.5
Using newrelic_rpm 3.14.2.312
Installing pg 0.18.4 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby -r ./siteconf20160617-92261-aw26bh.rb extconf.rb
checking for pg_config... yes
Using config values from /usr/local/bin/pg_config
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.h... yes
checking for pg_config_manual.h... yes
checking for PQconnectdb() in -lpq... no
checking for PQconnectdb() in -llibpq... no
checking for PQconnectdb() in -lms/libpq... no
Can't find the PostgreSQL client library (libpq)
*** 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=/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
--with-pg
--without-pg
--enable-windows-cross
--disable-windows-cross
--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}/
--with-pqlib
--without-pqlib
--with-libpqlib
--without-libpqlib
--with-ms/libpqlib
--without-ms/libpqlib
extconf failed, exit code 1
...
Using faraday 0.9.2
Using hashie-forbidden_attributes 0.1.1
Using httparty 0.13.7
An error occurred while installing pg (0.18.4), and Bundler cannot continue.
Make sure that `gem install pg -v '0.18.4'` succeeds before bundling.
I have tried numerous of the other solutions on stack overflow including:
Bundler::GemNotFound: Could not find rake-10.3.2 in any of the sources
An error occurred while installing pg (0.17.1), and Bundler cannot continue
and have installed postgres on my machine (i think) using the app and brew.
Any ideas for making this work would be greatly appreciated!
I don't think the error is RubyMine-related; I think it's system-related.
That is, if you do gem install pg on the command line, I suspect you'll get the same error.
I use rvm and it just works. It installs the necessary system libraries. (That said, others have had difficulties from time to time.)
If you're interested in using rvm, google "install rvm" to get the link for the installation instructions.
That said, you should make sure RubyMine is configured for your project to use the same Ruby you are using on the command line. That way, you will get consistent results in both environments.
Also. just FYI, you can email support#jetbrains.com for RubyMine questions.
I cloned a rails repo and i am now attempting to bundle install
Background:
OSX El Capitan
ruby 2.2.3p173 (2015-08-18 revision 51636)
[x86_64-darwin15]
rails -v Could not find gem 'pg (>= 0) ruby' in any of the gem sources listed in your Gemfile or available on this machine. Run bundle install to install missing gems.
bundle install
Fetching gem metadata from https://rubygems.org/............
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
Resolving dependencies...
Using rake 10.4.2
...
Using jbuilder 2.3.2
Using jquery-rails 4.0.5
Your user account isn't allowed to install to the system Rubygems.
You can cancel this installation and run:
bundle install --path vendor/bundle
to install the gems into ./vendor/bundle/, or you can enter your password
and install the bundled gems to Rubygems using sudo.
Password:
Installing pg 0.18.3 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/usr/local/opt/ruby/bin/ruby -r ./siteconf20151105-3981-12lvpnr.rb 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=/usr/local/Cellar/ruby/2.2.3/bin/$(RUBY_BASE_NAME)
--with-pg
--without-pg
--enable-windows-cross
--disable-windows-cross
--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}/lib
extconf failed, exit code 1
Gem files will remain installed in /var/folders/lj/c7hfzz254cd3lt2nxscv_wgw0000gn/T/bundler20151105-3981-149quvepg-0.18.3/gems/pg-0.18.3 for inspection.
Results logged to /var/folders/lj/c7hfzz254cd3lt2nxscv_wgw0000gn/T/bundler20151105-3981-149quvepg-0.18.3/extensions/x86_64-darwin-15/2.2.0/pg-0.18.3/gem_make.out
An error occurred while installing pg (0.18.3), and Bundler cannot continue.
Make sure that `gem install pg -v '0.18.3'` succeeds before bundling.
At this point I run gem install pg -v '0.18.3'
building native extensions. This could take a while...
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
/usr/local/opt/ruby/bin/ruby -r ./siteconf20151105-4004-1ylkqpt.rb 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=/usr/local/Cellar/ruby/2.2.3/bin/$(RUBY_BASE_NAME)
--with-pg
--without-pg
--enable-windows-cross
--disable-windows-cross
--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}/lib
extconf failed, exit code 1
Gem files will remain installed in /usr/local/lib/ruby/gems/2.2.0/gems/pg-0.18.3 for inspection.
Results logged to /usr/local/lib/ruby/gems/2.2.0/extensions/x86_64-darwin-15/2.2.0/pg-0.18.3/gem_make.out
My gem file has the following at the bottom
# Use sqlite3 as the database for Active Record
group :development, :test do
gem 'sqlite3'
end
group :production do
gem 'rails_12factor'
gem 'pg'
end
I'm looking at the following SO question, but cannot seem to figure out the equivalent to OSX.
Seems that you just don't have the Postgres installed. Install it using something like:
brew install postgres
(if you have the Homebrew)
And then try to compile the gem extensions again.
edit
What worked for me was running:
brew doctor
I then had to chown a few files and delete a few things it asked me to.
I then ran
sudo gem install pg
and it worked. Not sure why it only worked with 'sudo' but when I tried before without it failed
I've used bundler to install a bunch of gems(most failed and I spent hours looking through internet posts on how to install the specific gems.
At the current moment running
bundle install
complains about the following
jacks-MacBook-Pro:techendo jsw$ bundle install
Fetching source index from https://rubygems.org/
Using rake 10.3.2
Using i18n 0.6.9
Using minitest 4.7.5
Using multi_json 1.10.1
Using thread_safe 0.3.4
Using tzinfo 0.3.39
Using activesupport 4.0.3
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.3
Using mime-types 1.25.1
Using polyglot 0.3.5
Using treetop 1.4.15
Using mail 2.5.4
Using actionmailer 4.0.3
Using active_utils 2.2.1
Using json 1.8.1
Using active_shipping 0.12.2
Using activemodel 4.0.3
Using activerecord-deprecated_finders 1.0.3
Using arel 4.0.2
Using activerecord 4.0.3
Using addressable 2.3.6
Using mini_portile 0.6.0
Using nokogiri 1.6.2.1
Using ruby-hmac 0.4.0
Using amazon-ecs 2.2.5
Using aws-sdk 1.42.0
Using bcrypt 3.1.7
Using multi_xml 0.5.5
Using httparty 0.13.1
Using multipart-post 2.0.0
Using faraday 0.9.0
Using jwt 1.0.0
Using oauth2 0.9.4
Using bitly 0.10.1
Using sass 3.2.19
Using bootstrap-sass 3.1.1.1
Using buftok 0.2.0
Using cinch 2.1.0
Using climate_control 0.0.3
Using cocaine 0.5.4
Using daemons 1.1.9
Using dalli 2.7.2
Using delayed_job 4.0.1
Using delayed_job_active_record 4.0.1
Using orm_adapter 0.5.0
Using thor 0.19.1
Using railties 4.0.3
Using warden 1.2.3
Using devise 3.2.4
Using diff-lcs 1.2.5
Using equalizer 0.0.9
Using exception_notification 4.0.1
Using excon 0.34.0
Using execjs 2.1.0
Using friendly_id 5.0.4
Using geocoder 1.2.1
Using gibbon 1.1.3
Using google_custom_search 0.3.1
Using heroku-api 0.3.18
Using heroku-deflater 0.5.3
Using hike 1.2.3
Using htmlentities 4.3.2
Using http_parser.rb 0.6.0
Using http 0.6.1
Using imgkit 1.4.1
Using jquery-rails 3.1.0
Using jquery-ui-rails 4.2.1
Using kgio 2.9.2
Using libv8 3.16.14.3
Using tilt 1.4.1
Using mail_view 2.0.4
Using mandrill-api 1.0.51
Using memcachier 0.0.2
Using memoizable 0.4.2
Using meta-tags 2.0.0
Using mixpanel-ruby 1.4.0
Using naught 1.0.0
Using nested_form 0.3.2
Using newrelic_rpm 3.8.1.221
Using paperclip 4.1.1
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/Users/jsw/.rvm/rubies/ruby-2.1.1/bin/ruby extconf.rb --with-pg-config=/Applications/Postgres.app/Contents/MacOS/bin/pg_config
Using config values from /Applications/Postgres.app/Contents/MacOS/bin/pg_config
sh: /Applications/Postgres.app/Contents/MacOS/bin/pg_config: No such file or directory
sh: /Applications/Postgres.app/Contents/MacOS/bin/pg_config: No such file or directory
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=/Users/jsw/.rvm/rubies/ruby-2.1.1/bin/ruby
--with-pg
--without-pg
--with-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}/lib
extconf failed, exit code 1
Gem files will remain installed in /Users/jsw/.rvm/gems/ruby-2.1.1/gems/pg-0.17.1 for inspection.
Results logged to /Users/jsw/.rvm/gems/ruby-2.1.1/extensions/x86_64-darwin-12/2.1.0-static/pg-0.17.1/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.
On another stack overflow post the following was suggested
Here's how I fixed it (with homebrew):
Install another build of Xcode Tools (typing 'brew update' in the terminal will prompt you to update the Xcode build tools)
brew update
brew install postgresql
but when I do
brew install postgresql
I get the following:
Warning: postgresql-9.3.4 already installed, it's just not linked
I can't find a post that covers how to do this. Can someone explain how I'm suppose to link this? or how to the
libpq-fe.h header
I tried doing
brew uninstall postgresql
brew install postgresql
which gave me
brew uninstall postgresql
Uninstalling /usr/local/Cellar/postgresql/9.3.4...
jacks-MacBook-Pro:techendo jsw$ brew install postgresql
==> Downloading https://downloads.sf.net/project/mach
Already downloaded: /Library/Caches/Homebrew/postgresql-9.3.4.mavericks.bottle.2.tar.gz
==> Pouring postgresql-9.3.4.mavericks.bottle.2.tar.g
==> Caveats
If builds of PostgreSQL 9 are failing and you have version 8.x installed,
you may need to remove the previous version first. See:
https://github.com/Homebrew/homebrew/issues/issue/2510
To migrate existing data from a previous major version (pre-9.3) of PostgreSQL, see:
http://www.postgresql.org/docs/9.3/static/upgrading.html
When installing the postgres gem, including ARCHFLAGS is recommended:
ARCHFLAGS="-arch x86_64" gem install pg
To install gems without sudo, see the Homebrew wiki.
To have launchd start postgresql at login:
ln -sfv /usr/local/opt/postgresql/*.plist ~/Library/LaunchAgents
Then to load postgresql now:
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
Or, if you don't want/need launchctl, you can just run:
postgres -D /usr/local/var/postgres
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink share/man/man3/SPI_connect.3
/usr/local/share/man/man3 is not writable.
You can try again using:
brew link postgresql
==> Summary
🍺 /usr/local/Cellar/postgresql/9.3.4: 2921 files, 38M
It still says it's installed but not linked so I ran
brew link postgresql
I get the following
jacks-MacBook-Pro:techendo jsw$ brew link postgresql
Linking /usr/local/Cellar/postgresql/9.3.4...
Error: Could not symlink share/man/man3/SPI_connect.3
/usr/local/share/man/man3 is not writable.
It was suggested that I do
ARCHFLAGS="-arch x86_64" gem install pg
Which I did
jacks-MacBook-Pro:techendo jsw$ ARCHFLAGS="-arch x86_64" gem install pg
Building native extensions. This could take a while...
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
/Users/jsw/.rvm/rubies/ruby-2.1.1/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=/Users/jsw/.rvm/rubies/ruby-2.1.1/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}/lib
extconf failed, exit code 1
Gem files will remain installed in /Users/jsw/.rvm/gems/ruby-2.1.1/gems/pg-0.17.1 for inspection.
Results logged to /Users/jsw/.rvm/gems/ruby-2.1.1/extensions/x86_64-darwin-12/2.1.0-static/pg-0.17.1/gem_make.out
What worked for me was running:
brew doctor
I then had to chown a few files and delete a few things it asked me to.
I then ran
sudo gem install pg
and it worked. Not sure why it only worked with 'sudo' but when I tried before without it failed
The problem is the same that this one:
Can't find the 'libpq-fe.h header when trying to install pg gem
brew install postgresql
I'm suddenly running into this issue when running 'bundle install'. Everything seems to be installing correctly, but then I run into an issue with 'pg', as so many others seem to do. As the message says, I try running 'gem install pg - '0.12.2'' but it still fails.
I'm on Snow Leopard 10.6 and this is the error I'm getting:
Installing pg (0.12.2) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/Users/thomaskim/.rvm/rubies/ruby-1.9.3-p327/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/thomaskim/.rvm/rubies/ruby-1.9.3-p327/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 /Users/thomaskim/.bundler/tmp/1336/gems/pg-0.12.2 for inspection.
Results logged to /Users/thomaskim/.bundler/tmp/1336/gems/pg-0.12.2/ext/gem_make.out
An error occurred while installing pg (0.12.2), and Bundler cannot continue.
Make sure that `gem install pg -v '0.12.2'` succeeds before bundling.
First you need to make sure you have command line tools (package for Xcode) installed. Since you're on old version of OSX - you will have to research how to do that.
Than, using homebrew install postgress
brew install postgres
After that, everything should bundle with no issues.
It appears that you do not have postgres installed properly. I got a similar error when I was trying to install a pg module with npm. It disappeared after installing postgres properly.
Here's a link to download: http://www.postgresql.org/download/macosx/
If you run rails on your machine only in dev mode and use sql lite for that, you need don't need to install the production bundles.
So if your gemfile looke like that:
group :production do
gem 'pg'
end
Try installing the bundles with the following command:
gem install --without production