0

I am trying to deploy a ruby on rails app to Heroku and am getting and an error. I have followed the tutortial and added postgres to my gem file but when I try to "git push heroku master" I get the following error:

Output **

id: treebook $ git push heroku master
Counting objects: 297, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (271/271), done.
Writing objects: 100% (297/297), 109.43 KiB | 0 bytes/s, done.
Total 297 (delta 116), reused 0 (delta 0)

-----> Ruby/Rails app detected
-----> Using Ruby version: ruby-2.0.0
-----> Installing dependencies using Bundler version 1.3.2
       New app detected loading default bundler cache
       Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin --deployment
       You are trying to install in deployment mode after changing
       your Gemfile. Run `bundle install` elsewhere and add the
       updated Gemfile.lock to version control.
       You have added to the Gemfile:
       * pg
       Bundler Output: You are trying to install in deployment mode after changing
       your Gemfile. Run `bundle install` elsewhere and add the
       updated Gemfile.lock to version control.

       You have added to the Gemfile:
       * pg
 !
 !     Failed to install gems via Bundler.
 !

 !     Push rejected, failed to compile Ruby/Rails app

To git@heroku.com:aqueous-headland-9388.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@heroku.com:aqueous-headland-9388.git'

It tells me to 'bundle install' and when I do that I get:

Output **

...
Using devise (3.1.1) 
Using jquery-rails (3.0.4) 
Installing pg (0.17.0) 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

    /Users/tithos/.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
    --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/tithos/.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/tithos/.rvm/gems/ruby-2.0.0-p247/gems/pg-0.17.0 for inspection.
Results logged to /Users/tithos/.rvm/gems/ruby-2.0.0-p247/gems/pg-0.17.0/ext/gem_make.out

An error occurred while installing pg (0.17.0), and Bundler cannot continue.
Make sure that `gem install pg -v '0.17.0'` succeeds before bundling.

When I try gem install pg -v '0.17.0' I get:

Output **

id: treebook $ gem install pg -v '0.17.0'
Building native extensions.  This could take a while...
ERROR:  Error installing pg:
    ERROR: Failed to build gem native extension.

    /Users/tithos/.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
    --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/tithos/.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/tithos/.rvm/gems/ruby-2.0.0-p247/gems/pg-0.17.0 for inspection.
Results logged to /Users/tithos/.rvm/gems/ruby-2.0.0-p247/gems/pg-0.17.0/ext/gem_make.out

I am totally lost. Any help would be great.

I tried 'brew install postgresql' and got:

id: treebook $ brew install postgresql
Warning: It appears you have MacPorts or Fink installed.
Software installed with other package managers causes known problems for
Homebrew. If a formula fails to build, uninstall MacPorts/Fink and try again.
==> Downloading http://ftp.postgresql.org/pub/source/v9.2.4/postgresql-9.2.4.tar
######################################################################## 100.0%
==> Patching
patching file src/pl/plpython/Makefile
patching file contrib/uuid-ossp/uuid-ossp.c
==> ./configure --prefix=/usr/local/Cellar/postgresql/9.2.4 --datadir=/usr/local
checking for POSIX signal interface... yes
checking for working memcmp... yes
checking for tclsh... /usr/bin/tclsh
checking for tclConfig.sh... no
configure: error: file 'tclConfig.sh' is required for Tcl
Error: Homebrew doesn't know what compiler versions ship with your version
of Xcode (5.0.1). Please `brew update` and if that doesn't help, file
an issue with the output of `brew --config`:
  https://github.com/mxcl/homebrew/issues

Thanks!

READ THIS: https://github.com/mxcl/homebrew/wiki/troubleshooting

These open issues may also help:
    https://github.com/mxcl/homebrew/issues/23178
id: treebook $ brew update
error: The following untracked working tree files would be overwritten by merge:
    Library/Formula/spim.rb
Please move or remove them before you can merge.
Aborting
Error: Failure while executing: git pull -q origin refs/heads/master:refs/remotes/origin/master
Tithos
  • 1,191
  • 4
  • 17
  • 40

1 Answers1

0

If you have postgres installed:

Try:

echo "alias pg='pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log'" >> ~/.bash_profile
source ~/.bash_profile

Or: https://stackoverflow.com/a/9669523/2670516

If not:

Linux: https://stackoverflow.com/a/10792110/2670516

Mac:

brew install postgresql
initdb /usr/local/var/postgres -E utf8

# Add PostgreSQL to launchctl to let OS X manage the process and start when you login
ln -sfv /usr/local/opt/postgresql/*.plist ~/Library/LaunchAgents
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist

echo "alias pg='pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log'" >> ~/.bash_profile
source ~/.bash_profile
pg start
# Usage: pg {start|stop|restart|reload|status}

src: http://createdbypete.com/articles/ruby-on-rails-development-with-mac-os-x-mountain-lion/

Community
  • 1
  • 1
  • When I try brew install postgresql I get: id: treebook $ brew install postgresql Warning: It appears you have MacPorts or Fink installed. Software installed with other package managers causes known problems for Homebrew. If a formula fails to build, uninstall MacPorts/Fink and try again. Error: File exists - /usr/local/lib/python2.7/site-packages – Tithos Oct 20 '13 at 00:30
  • Remove MacPorts: http://guide.macports.org/chunked/installing.macports.uninstalling.html or Fink. And Install HomeBrew: http://brew.sh/ – André Augusto Costa Santos Oct 20 '13 at 00:35