Install Homebrew on macOS
201116
As it is stated at the Homebrew site, Homebrew is ”The Missing Package Manager for macOS (or Linux)“.
These are the main functionalities the Homebrew provides:
- 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.
- Trivially create your own Homebrew packages.
- 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 formulae are simple Ruby scripts
- 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.
- Making a cask is as simple as creating a formula.
The installation is pretty straightforward. To install it just paste the command below, at a Terminal prompt:
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
The script explains what it will do and then pauses before it does it. There are more installation options here (required for OS X Lion 10.7 and below).
Brew installs itself into a shared folder, called /usr/local. This will allow us to share installed commands across all users on our Mac. However, only the user who installed Brew will be able to modify the commands.
HomeBrew keeps all packages installed under the /usr/local/Cellar folder.
Check brew installation
$ brew -v or $ brew --version $ which brew
➜ ~ ➜ ~ brew -v Homebrew 2.1.16 Homebrew/homebrew-core (git revision 11eacb; last commit 2019-11-25) ➜ ~ ➜ ~ brew --version Homebrew 2.5.10 Homebrew/homebrew-core (git revision fcaea; last commit 2020-11-15) ➜ ~ ➜ ~ which brew /usr/local/bin/brew ➜ ~
List all packages installed via brew
$ brew list
➜ ~ brew list autoconf jq libusbmuxd openssl@1.1 tree automake libidn2 libxml2 pcre usbmuxd cocoapods libimobiledevice libzip pkg-config wget gdbm libplist mongodb python xz gettext libtasn1 ncurses python@2 zsh icu4c libtool node readline ideviceinstaller libunistring oniguruma sphinx-doc ios-deploy libusb openssl sqlite ➜ ~
List all packages and items installed via brew Cask
$ brew list --cask
Other useful brew (Homebrew) commands
$ brew update $ brew upgrade $ brew cleanup $ brew doctor
brew services commands
Use brew services commands to start, stop and restart brew packages/services installed via brew, e.g.
$ brew services start httpd $ brew services start php $ brew services start mariadb
Use brew services list to list all running services. (The list of services will also include any services started with launchctl load, not just services that have been loaded with brew services.
$ brew services list
Use brew help or brew help services to obtain instructions
$ brew help $ brew help services
Find here the official Homebrew documentation.
That’s it!
Thank you for reading!