Mac os database

And then you can run the following command to start Postgres as a background service:
brew services start postgresql |
Postgres will also restart automatically at login after you have run the command above.
Once Postgres has started, we can use brew services to stop it manually:
1 2 3 |
brew services stop postgresql Stopping `postgresql`... (might take a while)==> Successfully stopped `postgresql` (label: homebrew.mxcl.postgresql) |
Or we can also use brew services to restart Postgres:
1 2 3 4 |
brew services restart postgresql Stopping `postgresql`... (might take a while)==> Successfully stopped `postgresql` (label: homebrew.mxcl.postgresql)==> Successfully started `postgresql` (label: homebrew.mxcl.postgresql) |
Now you should have PostgreSQL all set up.
Set Up Postgres to Work with a Rails App
First, install the pg gem:
gem install pg - -with-pg-config=/usr/local/bin/pg_config |
Make sure you include the pg gem in your Gemfile, and run
Now, set up your config/database.yml file to point to your Posgres database.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
development:adapter: postgresqlencoding: unicodedatabase: myapp_devpool: 5username: your_username_on_macpassword: test:adapter: postgresqlencoding: unicodedatabase: myapp_testpool: 5username: your_username_on_macpassword: |