Homebrew Terminal



  • Install Homebrew


    Paste that in a macOS Terminal or Linux shell prompt.

    The script explains what it will do and then pauses before it does it. Read about other installation options.

  • What Does Homebrew Do?


    Homebrew installs the stuff you need that Apple (or your Linux system) didn’t.

  • Homebrew installs packages to their own directory and then symlinks their files into /usr/local.

  • Homebrew won’t install files outside its prefix and you can place a Homebrew installation wherever you like.

  • It’s all Git and Ruby underneath, so hack away with the knowledge that you can easily revert your modifications and merge upstream updates.

  • Homebrew complements macOS (or your Linux system). Install your RubyGems with gem and their dependencies with brew.

  • “To install, drag this icon…” no more. Homebrew Cask installs macOS apps, fonts and plugins and other non-open source software.

  • Donate to Homebrew

  • Homebrew Blog

  • Analytics Data

  • Homebrew was created by Max Howell. Website by Rémi Prévost, Mike McQuaid and Danielle Lalonde.

To install Homebrew, open Terminal or your favorite OS X terminal emulator and run. Once you’ve installed Homebrew, insert the Homebrew directory at the top of your PATH environment variable. You can do this by adding the following line at the bottom of your /.profile file. If you are asking what I saw in the terminal when installing Homebrew thru the /bin/bash -c command above was the warning as well as a notification confirming Homebrew had been successfully installed – GPP Jan 5 at 7:42. I'm saying that during my installation. Homebrew docs docs.brew.sh; 0 Comments for this cheatsheet. Devhints.io / Over 352 curated cheatsheets, by developers for developers. Devhints home Other CLI cheatsheets. Cron cheatsheet httpie cheatsheet adb (Android Debug Bridge).

Cask brings simplicity and speed to installing and managing GUI applications on macOS.


In this tutorial we will learn to install PostgreSQL database on Mac using Homebrew.

Prerequisite

It is assumed that you have Homebrew installed on your Mac.

If you don't have Homebrew installed on your Mac then open Terminal and run the following command.

You can visit Homebrew official website https://brew.sh to learn more about it.

Once you have Homebrew (a.k.a. brew) installed on your machine you can run the following command in the Terminal to check the version.

To update run the following command.

Alright, time to install PostgreSQL on Mac.

Install PostgreSQL using Homebrew

In Terminal run the following command to install PostgreSQL on Mac using Homebrew.

We can check the version of PostgreSQL using the psql command.

Start PostgreSQL

Theme

To start PostgreSQL run the following command in the Terminal.

We will get a similar output shown below.

Stop PostgreSQL

To stop PostgreSQL run the following command in the Terminal.

We will get a similar output.

Install Brew On Mac

Restart PostgreSQL

To restart PostgreSQL run the following command in the Terminal.

We will get a similar output as shown below.

Login to PostgreSQL database

By default we will get a database by the name postgres. So, to connect to it we will run the following command.

We will see the following output.

Homebrew Terminal Prompts Disabled

List all the users

To list all the users we use the du command.

List all the databases

Brew mac os

To list all the databases run the l command.

Create a database

To create a database run the following command. In the given example mydb is the name of the database.

Connect to a database

To connect to a database use the c command.

List all the tables inside a database

Homebrew

Homebrew Terminology

Homebrew Terminal

Mac Terminal Homebrew

To list all the tables inside a database we run the d command.

Note! If there is no table then we will get a prompt stating no relations found.

Let us go ahead and create a simple users table inside the mydb database and try the above command again.

Create table

In the following example we are creating a simple users table.

Now if we list the tables using the d command we will get the table.

Homebrew For Terminal

How to exit from psql?

Homebrew

To exit or quit from psql type the q command.

Alright, this brings us to the end of this tutorial. Hope you found it useful. Please share this tutorial if it was helpful. See you in the next tutorial. Have fun developing :-)