How To Configure PostgreSQL On Mac
Our featured tutorial for today comes from Ruby on Rails developer Gavin Morgan via Natasha Murashev’s blog “Natasha the Robot.” In this tutorial, you’ll learn how to download and configure PostgreSQL with your Rails application on a Mac platform.
Simply follow the instructions below:
- Visit postgresapp.com & download the app.
- Install & run the app.
- Execute “$ psql -h localhost” to enter local psql terminal.
- Execute “=# select * from pg_roles;” to list the accounts with access privelages.
- Execute “$ rails new myApp -d postgresql” to create psql rails app.
- Fix config/database.yml to include your psql credentials — ‘username‘and ‘password’ (you can leave the password blank if you don’ remember it).
- Fit ‘host: localhost‘ into config/database.yml under ‘test:’ & ‘development:‘
Note: Heroku will throw database.yml away & use its own settings.
- Execute “$ rake db:create:all” to create your psql databases.
Note: If you have installed PostgreSQL before via ‘$brew install postgresql’ and it’s not working for you, you may opt to find someone more experienced to help you make it work.
For more additional info, you may read Natasha’s version of the tutorial HERE.