1

I'm trying to install this Rails project located here (https://github.com/harrystech/prelaunchr). I know that it's a bit outdated and the project has been archived, but I'd like to try and modify it to create a similar launch campaign. This is my very first Rails project (first individual programming project for that matter), and before engaging my Eng team, I thought I could also ask for some assistance here.

I've been successful with everything up to the "Copy the local database.yml file sample..." step, but when I go to "Setup your local database" step, I get this error:

Could not find pg-0.18.4 in any of the sources
Run `bundle install` to install missing gems.

When I try to run the 'bundle install' this is the error I get:

sahrsaffa@sahrs-MacBook-Air prelaunchr % bundle install
    Fetching gem metadata from https://rubygems.org/.............
    Using rake 12.3.2
    Using concurrent-ruby 1.1.3
    Using i18n 0.9.5
    Using minitest 5.11.3
    Using thread_safe 0.3.6
    Using tzinfo 1.2.5
    Using activesupport 4.2.11
    Using builder 3.2.3
    Using erubis 2.7.0
    Using mini_portile2 2.3.0
    Using nokogiri 1.8.5
    Using rails-deprecated_sanitizer 1.0.3
    Using rails-dom-testing 1.0.9
    Using crass 1.0.4
    Using loofah 2.2.3
    Using rails-html-sanitizer 1.0.4
    Using actionview 4.2.11
    Using rack 1.6.11
    Using rack-test 0.6.3
    Using actionpack 4.2.11
    Using globalid 0.4.1
    Using activejob 4.2.11
    Using mini_mime 1.0.1
    Using mail 2.7.1
    Using actionmailer 4.2.11
    Using arbre 1.1.1
    Using rb-fsevent 0.10.2
    Using ffi 1.9.25
    Using rb-inotify 0.9.10
    Using sass-listen 4.0.0
    Using sass 3.5.5
    Using thor 0.20.3
    Using bourbon 5.0.0
    Using coffee-script-source 1.12.2
    Using execjs 2.7.0
    Using coffee-script 2.4.1
    Using railties 4.2.11
    Using coffee-rails 4.2.2
    Using formtastic 3.1.5
    Using formtastic_i18n 0.6.0
    Using has_scope 0.7.1
    Using responders 2.4.0
    Using inherited_resources 1.8.0
    Using jquery-rails 4.3.1
    Using jquery-ui-rails 6.0.1
    Using kaminari-core 1.1.1
    Using kaminari-actionview 1.1.1
    Using activemodel 4.2.11
    Using arel 6.0.4
    Using activerecord 4.2.11
    Using kaminari-activerecord 1.1.1
    Using kaminari 1.1.1
    Using polyamorous 1.3.3
    Using ransack 1.8.6
    Using sprockets 3.7.2
    Using sprockets-rails 3.2.1
    Using tilt 2.0.8
    Using sass-rails 5.0.7
    Using activeadmin 1.0.0
    Using bcrypt 3.1.11
    Using bundler 1.17.1
    Using coderay 1.1.1
    Using delayed_job 4.1.4
    Using delayed_job_active_record 4.1.2
    Using orm_adapter 0.5.0
    Using warden 1.2.7
    Using devise 4.4.1
    Using diff-lcs 1.3
    Using dotenv 2.1.0
    Using dotenv-rails 2.1.0
    Using json 2.1.0
    Using kgio 2.10.0
    Using method_source 0.8.2
    Fetching pg 0.18.4
    Installing pg 0.18.4 with native extensions
    Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory:
    /Users/sahrsaffa/.rvm/gems/ruby-2.5.3/gems/pg-0.18.4/ext
    /Users/sahrsaffa/.rvm/rubies/ruby-2.5.3/bin/ruby -I
    /Users/sahrsaffa/.rvm/rubies/ruby-2.5.3/lib/ruby/site_ruby/2.5.0 -r
    ./siteconf20200331-80485-5ewwyn.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=/Users/sahrsaffa/.rvm/rubies/ruby-2.5.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

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

    /Users/sahrsaffa/.rvm/gems/ruby-2.5.3/extensions/x86_64-darwin-19/2.5.0/pg-0.18.4/mkmf.log

    extconf failed, exit code 1

    Gem files will remain installed in
    /Users/sahrsaffa/.rvm/gems/ruby-2.5.3/gems/pg-0.18.4 for inspection.
    Results logged to
    /Users/sahrsaffa/.rvm/gems/ruby-2.5.3/extensions/x86_64-darwin-19/2.5.0/pg-0.18.4/gem_make.out

    An error occurred while installing pg (0.18.4), and Bundler
    cannot continue.
    Make sure that `gem install pg -v '0.18.4' --source
    'https://rubygems.org/'` succeeds before bundling.

Any help as to where I go from here would be greatly appreciated!

Thanks, Sahr

sjmario38
  • 33
  • 5
  • 1
    Does this answer your question? [Can't find the 'libpq-fe.h header when trying to install pg gem](https://stackoverflow.com/questions/6040583/cant-find-the-libpq-fe-h-header-when-trying-to-install-pg-gem) – Ana María Martínez Gómez Apr 01 '20 at 21:15
  • 1
    Please take a moment to read the Help Center topic https://stackoverflow.com/help/how-to-ask and note the first section _Search, and research...and keep track of what you find. Even if you don't find a useful answer elsewhere on the site, including links to related questions that haven't helped can help others in understanding how your question is different from the rest._ A quick search returns **173** results for your error message [`Can't find the 'libpq-fe.h header`](https://stackoverflow.com/search?q=Can%27t+find+the+%27libpq-fe.h+header). – anothermh Apr 01 '20 at 21:22

1 Answers1

1

You must have PostgreSQL installed on your macOS system to build the PostgreSQL ("pg") gem.

brew install postgresql

Try that, then run bundle install again.

the Tin Man
  • 158,662
  • 42
  • 215
  • 303
Patrick C
  • 186
  • 9
  • Thank you! Can you also clarify what this step means: Copy the local database.yml file sample and .env.sample: cp config/database.yml.sample config/database.yml cp .env.sample .env Update your newly created .env file with the needed configuration DEFAULT_MAILER_HOST: sets the action mailer default host as seen in config/environment/.rb. You will minimally need this in production. SECRET_KEY_BASE: sets a secret key to be used by config/initializers/devise.rb – sjmario38 Apr 01 '20 at 23:50
  • @sjmario38 Do you mind upvoting the answer if it helped you? Thanks – Patrick C Apr 01 '20 at 23:54
  • Yes, I did! However, since I'm a new user here it said that my first few upvotes won't show up publicly :( – sjmario38 Apr 02 '20 at 00:40
  • Appreciate it! To answer your last question.. that's telling you to copy and rename those files without .sample at the end. You can then configure those sample files to your needs, or leave as is. – Patrick C Apr 02 '20 at 04:35
  • Don't urge upvotes or to have your answer be selected. "[Do you feel dirty if you nudge new users to accept your answer when they indicate you've answered their question?](https://meta.stackexchange.com/questions/14994)" – the Tin Man Apr 02 '20 at 06:04