Skip to content

How to Install Homebrew on macOS - The Ultimate Package Manager

Published: at 02:06 PMSuggest Changes

What is Homebrew?

Homebrew is an open-source package management system that simplifies software installation on macOS. It’s often referred to as “the missing package manager for macOS” and is an essential tool for developers and power users.

Prerequisites

Installation Methods

Open Terminal and paste the following command:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Method 2: Manual Installation Steps

  1. Install Xcode Command Line Tools:
xcode-select --install
  1. Download and Run Homebrew Install Script:
curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh > homebrew_install.sh
chmod +x homebrew_install.sh
./homebrew_install.sh

Post-Installation Configuration

After installation, add Homebrew to your PATH:

For Zsh (default on macOS):

echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"

For Bash:

echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.bash_profile
eval "$(/opt/homebrew/bin/brew shellenv)"

Verify Installation

Check that Homebrew is installed correctly:

brew --version

Basic Homebrew Commands

Troubleshooting

Common Issues

  1. Permission Errors

    • Ensure you have write permissions to /usr/local
    • Use sudo carefully or change ownership
  2. Network Problems

    • Check your internet connection
    • Temporarily disable firewall if blocking

Best Practices

Conclusion

Homebrew transforms package management on macOS, making it incredibly easy to install, update, and manage software. Whether you’re a developer, designer, or power user, Homebrew is an indispensable tool in your macOS toolkit.

Further Reading


Previous Post
Comprehensive Guide to Installing Vim and Neovim on macOS