Skip to content

Instantly share code, notes, and snippets.

@ibraheem4
Forked from sgnl/postgres-brew.md
Last active April 19, 2025 14:27

Revisions

  1. ibraheem4 revised this gist Nov 9, 2022. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions postgres-brew.md
    Original file line number Diff line number Diff line change
    @@ -9,7 +9,7 @@ In your command-line run the following commands:
    1. `brew update`

    ## Installing
    1. In your command-line run the command: `brew install postgres`
    1. In your command-line run the command: `brew install postgresql@14`
    2. Run the command: `ln -sfv /usr/local/opt/postgresql/*.plist ~/Library/LaunchAgents`
    3. Create two new aliases to start and stop your postgres server. They could look something like this:

    @@ -28,10 +28,10 @@ In your command-line run the following commands:
    ```
    $ psql
    psql (10.0)
    psql (14.5 (Homebrew))
    Type "help" for help.
    ibraheem=#
    ibraheem=# exit
    ```
    ## Details
  2. ibraheem4 revised this gist Mar 1, 2021. 1 changed file with 0 additions and 5 deletions.
    5 changes: 0 additions & 5 deletions postgres-brew.md
    Original file line number Diff line number Diff line change
    @@ -14,13 +14,8 @@ In your command-line run the following commands:
    3. Create two new aliases to start and stop your postgres server. They could look something like this:

    ```
    # Newer
    alias pg_start="launchctl load ~/Library/LaunchAgents"
    alias pg_stop="launchctl unload ~/Library/LaunchAgents"
    # Old
    alias pg_start="launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist"
    alias pg_stop="launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist"
    ```
    4. Run the alias you just created: `pg_start`. Use this comment to start your database service.
  3. ibraheem4 revised this gist Mar 1, 2021. 1 changed file with 5 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions postgres-brew.md
    Original file line number Diff line number Diff line change
    @@ -14,6 +14,11 @@ In your command-line run the following commands:
    3. Create two new aliases to start and stop your postgres server. They could look something like this:

    ```
    # Newer
    alias pg_start="launchctl load ~/Library/LaunchAgents"
    alias pg_stop="launchctl unload ~/Library/LaunchAgents"
    # Old
    alias pg_start="launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist"
    alias pg_stop="launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist"
    ```
  4. ibraheem4 revised this gist Jun 28, 2020. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions postgres-brew.md
    Original file line number Diff line number Diff line change
    @@ -14,8 +14,8 @@ In your command-line run the following commands:
    3. Create two new aliases to start and stop your postgres server. They could look something like this:

    ```
    alias pg_start="launchctl load ~/Library/LaunchAgents"
    alias pg_stop="launchctl unload ~/Library/LaunchAgents"
    alias pg_start="launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist"
    alias pg_stop="launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist"
    ```
    4. Run the alias you just created: `pg_start`. Use this comment to start your database service.
  5. ibraheem4 revised this gist Jun 28, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion postgres-brew.md
    Original file line number Diff line number Diff line change
    @@ -22,7 +22,7 @@ In your command-line run the following commands:
    - alternatively, `pg_stop` stops your database service.
    5. Run the command: ``createdb `whoami` ``
    6. Connect to your postgres with the command: `psql`
    7. `brew reinstall readline` - **if needed**
    7. `brew reinstall readline` - **ONLY IF NEEDED**
    8. `createuser -s postgres` - fixes `role "postgres" does not exist`
    9. Test with `psql` command
  6. ibraheem4 revised this gist Jun 28, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion postgres-brew.md
    Original file line number Diff line number Diff line change
    @@ -9,7 +9,7 @@ In your command-line run the following commands:
    1. `brew update`

    ## Installing
    1. In your command-line run the command: `brew install postgresql`
    1. In your command-line run the command: `brew install postgres`
    2. Run the command: `ln -sfv /usr/local/opt/postgresql/*.plist ~/Library/LaunchAgents`
    3. Create two new aliases to start and stop your postgres server. They could look something like this:

  7. ibraheem4 revised this gist Jun 28, 2020. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions postgres-brew.md
    Original file line number Diff line number Diff line change
    @@ -14,8 +14,8 @@ In your command-line run the following commands:
    3. Create two new aliases to start and stop your postgres server. They could look something like this:

    ```
    alias pg_start="launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist"
    alias pg_stop="launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist"
    alias pg_start="launchctl load ~/Library/LaunchAgents"
    alias pg_stop="launchctl unload ~/Library/LaunchAgents"
    ```
    4. Run the alias you just created: `pg_start`. Use this comment to start your database service.
  8. ibraheem4 revised this gist Feb 16, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion postgres-brew.md
    Original file line number Diff line number Diff line change
    @@ -22,7 +22,7 @@ In your command-line run the following commands:
    - alternatively, `pg_stop` stops your database service.
    5. Run the command: ``createdb `whoami` ``
    6. Connect to your postgres with the command: `psql`
    7. **`brew reinstall readline` - if needed**
    7. `brew reinstall readline` - **if needed**
    8. `createuser -s postgres` - fixes `role "postgres" does not exist`
    9. Test with `psql` command
  9. ibraheem4 revised this gist Feb 16, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion postgres-brew.md
    Original file line number Diff line number Diff line change
    @@ -22,7 +22,7 @@ In your command-line run the following commands:
    - alternatively, `pg_stop` stops your database service.
    5. Run the command: ``createdb `whoami` ``
    6. Connect to your postgres with the command: `psql`
    7. `brew reinstall readline` - if needed
    7. **`brew reinstall readline` - if needed**
    8. `createuser -s postgres` - fixes `role "postgres" does not exist`
    9. Test with `psql` command
  10. ibraheem4 revised this gist Feb 16, 2019. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions postgres-brew.md
    Original file line number Diff line number Diff line change
    @@ -18,8 +18,8 @@ In your command-line run the following commands:
    alias pg_stop="launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist"
    ```
    4. Run the alias you just created: `pg-start`. Use this comment to start your database service.
    - alternatively, `pg-stop` stops your database service.
    4. Run the alias you just created: `pg_start`. Use this comment to start your database service.
    - alternatively, `pg_stop` stops your database service.
    5. Run the command: ``createdb `whoami` ``
    6. Connect to your postgres with the command: `psql`
    7. `brew reinstall readline` - if needed
  11. ibraheem4 revised this gist Oct 29, 2017. 1 changed file with 7 additions and 1 deletion.
    8 changes: 7 additions & 1 deletion postgres-brew.md
    Original file line number Diff line number Diff line change
    @@ -72,4 +72,10 @@ psql -U postgres -d <database_name>
    ```
    dropdb <database_name>
    ```
    > `dropdb mydjangoproject_development`
    > `dropdb mydjangoproject_development`
    ### Restart database
    ```
    dropdb <database_name> && createdb <database_name>
    ```
    > `dropdb mydjangoproject_development && createdb mydjangoproject_development`
  12. ibraheem4 revised this gist Oct 22, 2017. 1 changed file with 7 additions and 1 deletion.
    8 changes: 7 additions & 1 deletion postgres-brew.md
    Original file line number Diff line number Diff line change
    @@ -66,4 +66,10 @@ psql -U postgres -l
    ```
    psql -U postgres -d <database_name>
    ```
    > `psql -U postgres -d mydjangoproject_development`
    > `psql -U postgres -d mydjangoproject_development`
    ### Drop database
    ```
    dropdb <database_name>
    ```
    > `dropdb mydjangoproject_development`
  13. ibraheem4 revised this gist Oct 21, 2017. 1 changed file with 8 additions and 1 deletion.
    9 changes: 8 additions & 1 deletion postgres-brew.md
    Original file line number Diff line number Diff line change
    @@ -55,8 +55,15 @@ _from the `man launchctl` command_
    ```
    createdb <database_name>
    ```
    > `createdb mydjangoproject_development`
    ### List databases
    ```
    psql -U postgres -l
    ```
    ```
    ### Show tables in database
    ```
    psql -U postgres -d <database_name>
    ```
    > `psql -U postgres -d mydjangoproject_development`
  14. ibraheem4 revised this gist Oct 21, 2017. 1 changed file with 5 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions postgres-brew.md
    Original file line number Diff line number Diff line change
    @@ -54,4 +54,9 @@ _from the `man launchctl` command_
    ### Create database
    ```
    createdb <database_name>
    ```
    ### List databases
    ```
    psql -U postgres -l
    ```
  15. ibraheem4 revised this gist Oct 21, 2017. 1 changed file with 8 additions and 1 deletion.
    9 changes: 8 additions & 1 deletion postgres-brew.md
    Original file line number Diff line number Diff line change
    @@ -47,4 +47,11 @@ _from the `man ln` command_
    _from the `man launchctl` command_
    >launchctl interfaces with launchd to manage and inspect daemons, angents and XPC services.
    >launchctl interfaces with launchd to manage and inspect daemons, angents and XPC services.
    ## Commands
    ### Create database
    ```
    createdb <database_name>
    ```
  16. ibraheem4 revised this gist Oct 21, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion postgres-brew.md
    Original file line number Diff line number Diff line change
    @@ -31,7 +31,7 @@ In your command-line run the following commands:
    psql (10.0)
    Type "help" for help.
    ibraheem4=#
    ibraheem=#
    ```
    ## Details
  17. ibraheem4 revised this gist Oct 21, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion postgres-brew.md
    Original file line number Diff line number Diff line change
    @@ -31,7 +31,7 @@ In your command-line run the following commands:
    psql (10.0)
    Type "help" for help.
    user=#
    ibraheem4=#
    ```
    ## Details
  18. ibraheem4 revised this gist Oct 21, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion postgres-brew.md
    Original file line number Diff line number Diff line change
    @@ -27,7 +27,7 @@ In your command-line run the following commands:
    9. Test with `psql` command
    ```
    user@localhost ~ (🦋 ) :$ psql
    $ psql
    psql (10.0)
    Type "help" for help.
  19. ibraheem4 revised this gist Oct 21, 2017. 1 changed file with 9 additions and 0 deletions.
    9 changes: 9 additions & 0 deletions postgres-brew.md
    Original file line number Diff line number Diff line change
    @@ -24,6 +24,15 @@ In your command-line run the following commands:
    6. Connect to your postgres with the command: `psql`
    7. `brew reinstall readline` - if needed
    8. `createuser -s postgres` - fixes `role "postgres" does not exist`
    9. Test with `psql` command
    ```
    user@localhost ~ (🦋 ) :$ psql
    psql (10.0)
    Type "help" for help.
    user=#
    ```
    ## Details
    ### What is this `ln` command I ran in my Terminal?
  20. ibraheem4 revised this gist Oct 21, 2017. 1 changed file with 9 additions and 10 deletions.
    19 changes: 9 additions & 10 deletions postgres-brew.md
    Original file line number Diff line number Diff line change
    @@ -10,21 +10,20 @@ In your command-line run the following commands:

    ## Installing
    1. In your command-line run the command: `brew install postgresql`
    2. Read the **Caveats** section that is outputted to the Terminal.
    3. Run the command: `ln -sfv /usr/local/opt/postgresql/*.plist ~/Library/LaunchAgents`
    4. Open your zsh config file: `subl ~/.zshrc`
    5. At the bottom of the file, create two new aliases to start and stop your postgres server. They could look something like this:
    2. Run the command: `ln -sfv /usr/local/opt/postgresql/*.plist ~/Library/LaunchAgents`
    3. Create two new aliases to start and stop your postgres server. They could look something like this:

    ```
    alias pg-start="launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist"
    alias pg-stop="launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist"
    alias pg_start="launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist"
    alias pg_stop="launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist"
    ```
    6. Run the command: `source ~/.zshrc` to reload your configuration.
    7. Run the alias you just created: `pg-start`. Use this comment to start your database service.
    4. Run the alias you just created: `pg-start`. Use this comment to start your database service.
    - alternatively, `pg-stop` stops your database service.
    7. Run the command: ``createdb `whoami` ``
    8. Connect to your postgres with the command: `psql`
    5. Run the command: ``createdb `whoami` ``
    6. Connect to your postgres with the command: `psql`
    7. `brew reinstall readline` - if needed
    8. `createuser -s postgres` - fixes `role "postgres" does not exist`
    ## Details
    ### What is this `ln` command I ran in my Terminal?
  21. @sgnl sgnl revised this gist Apr 16, 2016. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions postgres-brew.md
    Original file line number Diff line number Diff line change
    @@ -3,10 +3,10 @@
    ## Pre-Reqs
    [Brew Package Manager](http://brew.sh)

    In your command-line run the folowing commands:
    In your command-line run the following commands:

    1. `brew doctor`
    1. `brew update`
    1. `brew doctor`
    1. `brew update`

    ## Installing
    1. In your command-line run the command: `brew install postgresql`
  22. @sgnl sgnl revised this gist Apr 16, 2016. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions postgres-brew.md
    Original file line number Diff line number Diff line change
    @@ -4,6 +4,7 @@
    [Brew Package Manager](http://brew.sh)

    In your command-line run the folowing commands:

    1. `brew doctor`
    1. `brew update`

  23. @sgnl sgnl revised this gist Apr 16, 2016. 1 changed file with 3 additions and 2 deletions.
    5 changes: 3 additions & 2 deletions postgres-brew.md
    Original file line number Diff line number Diff line change
    @@ -3,8 +3,9 @@
    ## Pre-Reqs
    [Brew Package Manager](http://brew.sh)

    In your command-line run the command: `brew update`

    In your command-line run the folowing commands:
    1. `brew doctor`
    1. `brew update`

    ## Installing
    1. In your command-line run the command: `brew install postgresql`
  24. @sgnl sgnl revised this gist Jan 20, 2016. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions postgres-brew.md
    Original file line number Diff line number Diff line change
    @@ -19,6 +19,8 @@ In your command-line run the command: `brew update`
    ```
    6. Run the command: `source ~/.zshrc` to reload your configuration.
    7. Run the alias you just created: `pg-start`. Use this comment to start your database service.
    - alternatively, `pg-stop` stops your database service.
    7. Run the command: ``createdb `whoami` ``
    8. Connect to your postgres with the command: `psql`
  25. @sgnl sgnl revised this gist Jul 18, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion postgres-brew.md
    Original file line number Diff line number Diff line change
    @@ -19,7 +19,7 @@ In your command-line run the command: `brew update`
    ```
    6. Run the command: `source ~/.zshrc` to reload your configuration.
    7. Run the command: ``createdb `whoami```
    7. Run the command: ``createdb `whoami` ``
    8. Connect to your postgres with the command: `psql`
    ## Details
  26. @sgnl sgnl revised this gist Jul 18, 2015. 1 changed file with 8 additions and 6 deletions.
    14 changes: 8 additions & 6 deletions postgres-brew.md
    Original file line number Diff line number Diff line change
    @@ -13,12 +13,14 @@ In your command-line run the command: `brew update`
    4. Open your zsh config file: `subl ~/.zshrc`
    5. At the bottom of the file, create two new aliases to start and stop your postgres server. They could look something like this:

    ```
    alias pg-start="launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist"
    alias pg-stop="launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist"
    ```

    Run the command: `source ~/.zshrc` to reload your configuration.
    ```
    alias pg-start="launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist"
    alias pg-stop="launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist"
    ```
    6. Run the command: `source ~/.zshrc` to reload your configuration.
    7. Run the command: ``createdb `whoami```
    8. Connect to your postgres with the command: `psql`
    ## Details
    ### What is this `ln` command I ran in my Terminal?
  27. @sgnl sgnl revised this gist Jul 18, 2015. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions postgres-brew.md
    Original file line number Diff line number Diff line change
    @@ -18,6 +18,8 @@ alias pg-start="launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.p
    alias pg-stop="launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist"
    ```

    Run the command: `source ~/.zshrc` to reload your configuration.

    ## Details
    ### What is this `ln` command I ran in my Terminal?

  28. @sgnl sgnl revised this gist Jul 18, 2015. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion postgres-brew.md
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,8 @@

    ## Pre-Reqs
    [Brew Package Manager](http://brew.sh)
    `brew update`

    In your command-line run the command: `brew update`


    ## Installing
  29. @sgnl sgnl revised this gist Jul 18, 2015. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions postgres-brew.md
    Original file line number Diff line number Diff line change
    @@ -2,6 +2,7 @@

    ## Pre-Reqs
    [Brew Package Manager](http://brew.sh)
    `brew update`


    ## Installing
  30. @sgnl sgnl revised this gist Jul 18, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion postgres-brew.md
    Original file line number Diff line number Diff line change
    @@ -5,7 +5,7 @@


    ## Installing
    1. In your command-line run the command: `brew install postgres`
    1. In your command-line run the command: `brew install postgresql`
    2. Read the **Caveats** section that is outputted to the Terminal.
    3. Run the command: `ln -sfv /usr/local/opt/postgresql/*.plist ~/Library/LaunchAgents`
    4. Open your zsh config file: `subl ~/.zshrc`