Skip to content

Instantly share code, notes, and snippets.

@jhenkens
Created April 3, 2014 01:16
Show Gist options
  • Save jhenkens/9946624 to your computer and use it in GitHub Desktop.
Save jhenkens/9946624 to your computer and use it in GitHub Desktop.
Ruby on Rails Tutorial (RailsTutorial.org) Postgres Setup
Install Postgres.app
Open the psql console via:
$ psql
Create the 'blog' user with CREATEDB permission;
# CREATE USER blog CREATEDB;
# \q
Set postgres to default to using a TCP port rather than a unix socket, because the Postgres.app defaults to TCP ports.
cat "export PGHOST=localhost" >> ~/.bash_profile
That last line is used to fix the following error which occurs only when running rails commands that access the postgres database, not the psql command itself. This is because Postgres.app defaults to using TCP ports rather than unix sockets for its connections.
Couldn't create database for {"adapter"=>"postgresql", "encoding"=>"unicode", "database"=>"blog_development", "pool"=>5, "username"=>"blog", "password"=>nil}
could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment