mardi 1 décembre 2015

Change database from SQLite to Postgresql: "gem install pg" error?

I have done everything to change my database to Postgresql.

1)I've tried uninstall and install from homebrew 2)I've tried install postgresql from the www.postgresql.org

But both of them is not working.. I've got same error when I tried to install "gem pg"

 $bundle install
 .
 .
 Installing pg 0.17.1 with native extensions

 Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

 current directory: /private/var/folders/jd/dn7zyf593n97j1rdjbbh_hl00000gn/T/bundler20151201-657-1v67eg6pg-0.17.1/gems/pg-0.17.1/ext
 /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby -r ./siteconf20151201-657-kkjx98.rb extconf.rb --with-pg config=/Applications/http://ift.tt/1kUXvLS
  Using config values from /Applications/http://ift.tt/1kUXvLS
  sh: /Applications/http://ift.tt/1kUXvLS: No such file or directory
  sh: /Applications/http://ift.tt/1kUXvLS: 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=/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/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}/

  To see why this extension failed to compile, please check the mkmf.log which can be found here:

 /var/folders/jd/dn7zyf593n97j1rdjbbh_hl00000gn/T/bundler20151201-657-1v67eg6pg-0.17.1/extensions/universal-darwin-15/2.0.0/pg-0.17.1/mkmf.log

  extconf failed, exit code 1

  Gem files will remain installed in /var/folders/jd/dn7zyf593n97j1rdjbbh_hl00000gn/T/bundler20151201-657-1v67eg6pg-0.17.1/gems/pg-0.17.1 for inspection.
 Results logged to /var/folders/jd/dn7zyf593n97j1rdjbbh_hl00000gn/T/bundler20151201-657-1v67eg6pg-0.17.1/extensions/universal-darwin-15/2.0.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.

Gemfile

 gem 'rails', '4.2.4'
 gem 'sdoc', '~> 0.4.0', group: :doc

 gem 'bootstrap-sass', '~> 3.2.0'
 gem 'autoprefixer-rails'
 gem 'pg', '0.17.1' 

 group :development, :test do

 gem 'sqlite3'
 gem 'byebug'
 gem 'web-console', '~> 2.0'
 gem 'spring'

 end

 group :production do
 gem 'rails_12factor', '0.0.2'
 gem 'puma',           '2.11.1'
 end

database.yml

default: &default
adapter: sqlite3
pool: 5
timeout: 5000

development:
adapter: postgresql
encoding: unicode
database: blog_development
pool: 5
username: ****
password: <!--- this place is **EMPTY** -->

test:
adapter: postgresql
encoding: unicode
database: blog_development
pool: 5
username: ****
password: <!--- this place is **EMPTY** -->

production:
 <<: *default
 database: db/production.sqlite3

Aucun commentaire:

Enregistrer un commentaire