Skip to content

Instantly share code, notes, and snippets.

@charlesa101
Forked from sgnl/postgres-brew.md
Created May 25, 2019 23:46
Show Gist options
  • Save charlesa101/4e204e4b6a460e94ecd3d75d138b9fc5 to your computer and use it in GitHub Desktop.
Save charlesa101/4e204e4b6a460e94ecd3d75d138b9fc5 to your computer and use it in GitHub Desktop.

Revisions

  1. @sgnl sgnl revised this gist Mar 7, 2018. 1 changed file with 14 additions and 1 deletion.
    15 changes: 14 additions & 1 deletion postgres-brew.md
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,16 @@
    **Outdated note: the process is a lot easier now**: after you `brew install postgresql` you can initialize or stop the daemon with these commands: `brew services start postgresql` or `brew services stop postgresql`.

    new out put may look like

    ```
    To have launchd start postgresql now and restart at login:
    brew services start postgresql
    Or, if you don't want/need a background service you can just run:
    pg_ctl -D /usr/local/var/postgres start
    ```

    thank you commenters (sorry I didnt notice you all before but thankful for not getting notifications 🤭)

    # Installing Postgres via Brew

    ## Pre-Reqs
    @@ -10,7 +23,7 @@ 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.
    2. Read the **Caveats** section that is outputted to the Terminal. (out dated?)
    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. @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`
  3. @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`

  4. @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`
  5. @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`
  6. @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
  7. @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?
  8. @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?

  9. @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
  10. @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
  11. @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`
  12. @sgnl sgnl revised this gist Jul 18, 2015. 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
    @@ -16,16 +16,16 @@ alias pg-start="launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.p
    alias pg-stop="launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist"
    ```

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

    _from the `man ln` command_

    > The ln utility creates a new directory entry (linked file) which has the same modes as the original file. It is useful for maintaining multiple copies of a
    file in many places at once without using up storage for the ``copies''; instead, a link ``points'' to the original copy. There are two types of links; hard
    links and symbolic links. How a link ``points'' to a file is one of the differences between a hard and symbolic link.

    **What is `launchctl`?**
    ### What is `launchctl`?

    _from the `man launchctl` command_

  13. @sgnl sgnl renamed this gist Jul 18, 2015. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  14. @sgnl sgnl created this gist Jul 18, 2015.
    32 changes: 32 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,32 @@
    # Installing Postgres via Brew

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


    ## Installing
    1. In your command-line run the command: `brew install postgres`
    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:

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

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

    _from the `man ln` command_

    > The ln utility creates a new directory entry (linked file) which has the same modes as the original file. It is useful for maintaining multiple copies of a
    file in many places at once without using up storage for the ``copies''; instead, a link ``points'' to the original copy. There are two types of links; hard
    links and symbolic links. How a link ``points'' to a file is one of the differences between a hard and symbolic link.

    **What is `launchctl`?**

    _from the `man launchctl` command_

    >launchctl interfaces with launchd to manage and inspect daemons, angents and XPC services.