Heroku: Failed to install gems via Bundler Heroku: Failed to install gems via Bundler heroku heroku

Heroku: Failed to install gems via Bundler


Follow steps -

Step 1: Remove Gemfile.lock from your project by manually or from following command -

rm -rf ~/.bundle/ ~/.gem/ .bundle/ Gemfile.lock

Step 2: Then bundle install

Step 3: git add .

Step 4: git commit -m "commiting Gemfile.lock"

Step 5: git push heroku master -f


First do a "git pull" to merge, and then push again.or try to Execute this: rake assets:precompile git add . git commit -m "Add precompiled assets for Heroku" git push heroku master -f


  1. to make sure you have install posgresSQL on your local by:

    • on MAC:

    brew install postgresql

    • on Ubuntu:

    sudo apt-get install libpq-dev

    • RHEL systems:

    yum install postgresql-devel

  2. Start the postgres on your local

    pg_ctl -D /usr/local/var/postgres start && brew services star postgresql

  3. Let’s make sure Postgres is installed and running

    postgres -V

  4. Login to Postgresql on terminal

    sudo -u postgres psql postgres

(You may need to provide the password 'root' )

  1. Create userPostgres doesn’t actually directly manage users or groups, like most standard permission models do. Instead, it directly manages what it calls roles

    CREATE ROLE testpostgres WITH LOGIN PASSWORD 'root';

  2. Assign createDB permission to our new user

    ALTER ROLE testpostgres CREATEDB;

  3. Set password for new user

    \password testpostgres

  4. Create your DB

    CREATE DATABASE yourDBName;

  5. Used Postico (eggerapps.at/postico/) with UI to manage PostgresDB.

User user setup above to login to your DB via Postico.

  1. After logged in, you may see the image like below

enter image description here

  1. Config your database.yml

    Change all adapter :sqlite3 to adapter :postgresql

    Provide the username and password login to DB by added two fields to your database.yml file like:

    default: &default adapter: postgresql pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> host: localhost username: testpostgres password: root timeout: 5000

Fell free to put your DB name with the field database, like:

production:  <<: *default  database: railsapp
  1. Run

    rake db:create

    rake db:migrate

  2. Commit and push code to Heroku again. It should be Ok.

References links :

https://www.codementor.io/devops/tutorial/getting-started-postgresql-server-mac-osx