Installing and Using Homebrew on macOS
So, you’ve got your shiny Mac running macOS, and you’re ready to turn it into a developer’s paradise. Enter Homebrew—the package manager that makes managing software on macOS a breeze. This guide will walk you through why you should use Homebrew, how to install it, and some tips and tricks to get the most out of it.
Why Use Homebrew on macOS?
Homebrew is a free and open-source package manager designed to simplify the installation of software on macOS (and Linux). Think of it as an App Store for the command line, where you can install apps and developer tools with a single command.
Pros and Cons
Pros
- Simplicity: Installing, updating, and managing software is a breeze.
- Customizability: Access to a vast library of packages, from productivity tools to quirky utilities.
- Community-driven: Regular updates and new packages added by a thriving open-source community.
- Dependency management: Automatically installs and manages dependencies for you.
- Uninstall-friendly: Removes software cleanly without leaving orphan files.
- Auto-updating casks: Homebrew automatically updates both command-line tools and applications (casks) installed through it, ensuring you always have the latest versions.
Cons
- Command-line knowledge required: A basic understanding of the terminal is needed (but don’t worry, you’ll learn fast!).
- Potential conflicts: Some packages may clash with system-provided software (though rare and usually fixable).
Installing Homebrew
Special Note: Homebrew requires the Xcode Command Line Tools (CLT) to work properly. Historically, these were installed using the command xcode-select --install
. However, Homebrew will now automatically install Xcode CLT during its setup process (if they are not already installed). I prefer to install with Homebrew, but if you prefer to manage this manually, you can still run xcode-select --install
before installing Homebrew.
Getting Homebrew set up is as easy as following the instructions on the Homebrew website.
Open your terminal (
Cmd + Space
, type “Terminal”).Paste the following command to install Homebrew:
1
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Follow the on-screen instructions to complete the installation.
💡 Pro Tip: After installation, run brew doctor
to ensure everything is configured correctly.
Common Commands
Homebrew’s commands are designed to be straightforward. Here are the essentials:
Search for a package:
1
brew search <package_name>
Install a package:
1
brew install <package_name>
Update Homebrew and packages:
1
brew update && brew upgrade
Uninstall a package:
1
brew uninstall <package_name>
Clean up old versions and cache:
1
brew cleanup
Popular Brews
Here’s where things get fun! Below are some of the most popular and useful packages you can install with Homebrew:
Developer Tools
node
: Install Node.js for JavaScript development.1
brew install node
python
: Get the latest version of Python.1
brew install python
cmake
: A build system generator essential for compiling and building software.1
brew install cmake
Productivity Boosters
htop
: A visual process manager for your terminal.1
brew install htop
tmux
: A terminal multiplexer to manage multiple terminal sessions.1
brew install tmux
fzf
: A fuzzy file finder for quick navigation in the terminal.1
brew install fzf
bat
: A bettercat
command with syntax highlighting.1
brew install bat
Fun and Quirky
figlet
: Create ASCII art from text. Perfect for spicing up your terminal.1 2
brew install figlet figlet Hello, World!
cowsay
: Adds a cow (or other animals) saying your message.1 2
brew install cowsay cowsay Moo!
lolcat
: Colorizes terminal output for extra flair.1
brew install lolcat
If you’ve installed both
figlet
andlolcat
try piping the output of figlet into lolcat:1
figlet Hello world! | lolcat
Essential Utilities
wget
: For downloading files from the internet.1
brew install wget
jq
: A lightweight JSON processor.1
brew install jq
tree
: Displays directory structures in a tree-like format.1
brew install tree
fd
: A simple, fast, and user-friendly alternative tofind
. Great for quickly searching your file system.1
brew install fd
Wrapping Up
Homebrew is one of the best tools to add to your macOS developer toolkit. Whether you’re setting up your machine for web development, data science, or just want to impress your friends with ASCII cows, Homebrew has something for everyone.
Got a favorite brew or tip? Drop a comment below and share the love! Until next time, happy brewing! 🍻