Homebrew is the package manager for macOS and if you are not using it I personally recommend to use homebrew.

Couple of commands which I use regularly

1.


brew install package-name

package-name is the name of the package which we want to install, we can specify the package-name in several different ways.

2.


brew list

# list all files in homebrew prefix, 
# which are not installed by homebrew
brew list --unbrewed

# list  all installed packages with version details
brew list --versions

# list packages which we have pinned to the specific version
brew list --pinned

List all installed packages. You can pass a couple of switches with this command to view different results. some of them are --unbrewed(list all files in homebrew prefix, which are not installed by homebrew), --versions(list all installed packages with version details), --pinned(list packages which we have pinned to the specific version)

3.


brew search

This command list all locally available packages

4.


brew update

It fetches the latest version of homebrew and installed packages from GitHub.

5.


brew upgrade

# upgrade a specific package
brew upgrade package-name

# removes previously installed versions 
# and installs them again
brew upgrade package-name --cleanup

Used to upgrade the single or multiple or all packages to the latest version available. Using this command we can upgrade the outdated and unpinned packages.
There are multiple options we can use with brew upgrade. We can upgrade a single package using brew upgrade package-name until the specified package is not pinned by the user. with --cleanup option It removes previously installed versions and installs them again.

6.


brew uninstall package-name

It uninstalls the given package.

7.


brew info

brew info --json=v1 <package-name>
# we can also get about the detailed information about installed packages 
brew info --json=v1 --installed 
# and all available commands
brew info --json=v1 --installed

Used to print the brief statistics for the homebrew installation.
To get detailed information about the packages we can use them

8.


brew pin package-name

Pin the specified package to the given/current version, and preventing them from being upgraded when we do the brew upgrade command.

9.


brew unpin <package-name>

It’s just opposite of brew pin and It allows packages to get upgraded when we issue the brew upgrade command.