Skip to content

Instantly share code, notes, and snippets.

@mrstebo
Created September 7, 2016 21:25
Show Gist options
  • Select an option

  • Save mrstebo/5cde2c4c39b97293aede00aabd1cf91e to your computer and use it in GitHub Desktop.

Select an option

Save mrstebo/5cde2c4c39b97293aede00aabd1cf91e to your computer and use it in GitHub Desktop.
Bash script for setting up Postgres for a local rails application
#!/bin/sh
echo -n "Please enter the username you want to add: "
read USERNAME
echo -n "Please enter the password for ${USERNAME} (will not be shown): "
read -s PASSWORD
echo ""
psql -U postgres -c "create user ${USERNAME} with password '${PASSWORD}';"
psql -U postgres -c "alter user ${USERNAME} superuser;"
echo "You should be able to run 'rails db:setup' or 'rake db:setup' to create your databases"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment