Text 8 Aug 3 notes Installing postgres with Brew in MacOSX

Homebrew is wonderful but sometimes it can be a little headache. For example, if you’ve created a rake task with ruby that assume a role called postgres (by default), probably if you installed with brew you won’t have it. Brew get your system user and unless your name would be postgres, you have to create it. For this reason, I’m going to write the easy steps to create a new role with admin privileges. Remembering, you did:

brew install postres
initdb /usr/local/var/postgres
mkdir -p ~/Library/LaunchAgents
cp /usr/local/Cellar/postgresql/9.0.4/org.postgresql.postgres.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/org.postgresql.postgres.plist
If you need a gem for posgres do:
env ARCHFLAGS="-arch x86_64" gem install pg
Install Instrumentation, in my case (postgres version 9.0.4):
psql -d postgres < /usr/local/Cellar/postgresql/9.0.4/share/postgresql/contrib/adminpack.sql
At this moment, you installed postgress (it’s only a note). Ok, let’s create a new role:
psql -d postgres
With this command, you’ll see all roles created:
postgres-# \du
We create a new user called postgres like this way:
postgres=# CREATE ROLE postgres SUPERUSER CREATEDB CREATEROLE LOGIN;
And that’s all. If you list all users again you’ll see that a new user has been created.

  1. rabarroso posted this

Design crafted by Prashanth Kamalakanthan. Powered by Tumblr.