DEV Community

chenchih
chenchih

Posted on

HomeBrew command Note

I’d like to share some brew commands. This command is used on macOS, similar to winget on Windows, and allows you to download packages or tools

Install Homebrew

Please refer to this link to install Homebrew. Just copy and paste the command into your terminal, and it will install automatically. You need to complete this step; otherwise, you won’t be able to use the brew command

brew command for cli tools

brew command is use to installs CLI tools / libraries / packages.

syntax: brew install <pkg>

Below are some of the commonly use and example of using brew to install

brew install git
brew install python
brew install node
brew install wget
Enter fullscreen mode Exit fullscreen mode
  • list installed tool:
brew list
Enter fullscreen mode Exit fullscreen mode
  • uninstall installed tool
brew uninstall git
Enter fullscreen mode Exit fullscreen mode

brew clask for application

Installs GUI/macOS applications (things you’d normally drag into /Applications)

Casks are built into Homebrew core.

syntax: brew install --cask <app>

  • install other applciation
brew install --cask iterm2
brew install --cask google-chrome
brew install --cask visual-studio-code
brew install --cask slack
Enter fullscreen mode Exit fullscreen mode
  • List installed casks:
brew list --cask
Enter fullscreen mode Exit fullscreen mode
  • search applications
brew search <name>
#ex:
brew search iterm2
Enter fullscreen mode Exit fullscreen mode
  • uninstall application
brew uninstall --cask iterm2
Enter fullscreen mode Exit fullscreen mode
  • Note for old version: No need to tap caskroom/cask. brew cask install ... (deprecated) Before (old Homebrew, pre-2020) install like this:
brew tap caskroom/cask
brew cask install <app>
Enter fullscreen mode Exit fullscreen mode

compare using brew and web to download:

  • Website download = manual management (install/update/uninstall yourself).
  • Homebrew cask = automated management (install/update/uninstall with commands).

Website download

Pros

  • Always the latest official release direct from the developer.
  • No dependency on Homebrew.

cons

  • Manual updates → you have to check for new versions yourself.
  • Harder to uninstall completely (you need to delete app + configs manually).

brew

Pro

  • Easy updates with brew upgrade (brew checks and installs new versions).
  • Scriptable → useful for setting up a new Mac quickly

Cons

  • Sometimes the version in Homebrew can lag behind the website by a few hours/days.
  • Requires Homebrew to be installed.

CLI tool → brew install

GUI app → brew install --cask

Top comments (0)