Create a Rails project with a postgresql database

If you already have Rails setup the defaults are to create a connection for a  SQLite database.

To switch this to a PostgeSQL database.

First install a PostgreSQL database on your machine for dev and test.

For apple computers, I suggest the

You also need the PG gem which connects PostgeSQL to Rails. To verify everything is ready to go, run

To create a new project with a PostgreSQL database run

This creates a new project connected postgresql

The connection settings for you new project are in the database.yml under config. Here are the default settings as of rails 4.2.4.


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.