homebrew-quick-setup-on-mac-2100-x-700

Mastering Homebrew: Quick Setup on Mac M1, M2, and M3

Unlock the full potential of your Mac with Homebrew—the essential package manager for macOS.


Table of Contents

  1. Introduction
  2. Prerequisites
  3. Step-by-Step Installation Guide
  4. Verifying the Installation
  5. Troubleshooting Tips
  6. Conclusion
  7. Additional Resources

Introduction

Homebrew is a free and open-source package manager that simplifies the installation of software on macOS. It allows you to install, update, and manage software packages from the command line, making it a must-have tool for developers and power users alike.

With Apple’s transition to their own silicon chips—M1, M2, and the latest M3—the installation process for some software has changed slightly. This guide will walk you through the quick and easy steps to get Homebrew up and running on your Mac equipped with these chips.


Prerequisites

Before you begin, ensure you have the following:

  • A Mac with an M1, M2, or M3 chip.
  • An active internet connection.
  • Basic familiarity with using the Terminal app.

Step-by-Step Installation Guide

1. Update macOS

It’s essential to have the latest version of macOS to ensure compatibility.

  1. Click on the Apple menu () in the top-left corner.
  2. Select System Settings (or System Preferences).
  3. Click on Software Update.
  4. If an update is available, click Update Now and follow the on-screen instructions.

2. Install Xcode Command Line Tools

The Xcode Command Line Tools provide essential developer tools needed by Homebrew.

  1. Open the Terminal app. You can find it via Spotlight Search (⌘ + Space) by typing “Terminal.”
  2. In the Terminal window, run:
xcode-select --install
  1. A software update popup will appear. Click Install and agree to the terms when prompted.

3. Install Homebrew

Now you’re ready to install Homebrew itself.

  1. In the Terminal, enter the following command:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  1. Press Enter. The script will explain what changes it will make and prompt you for confirmation.
  2. When prompted, enter your Mac’s admin password to proceed.
  3. The installation script will automatically detect your Mac’s architecture (M1, M2, or M3) and install Homebrew in the appropriate location (/opt/homebrew for Apple Silicon Macs).

To ensure your system recognizes Homebrew commands, you need to update your shell configuration.

4. Configure Environment Variables

1. Determine which shell you’re using by running:

echo $SHELL
  • If the output is /bin/zsh, you’re using Zsh (default for macOS Catalina and later).
  • If it’s /bin/bash, you’re using Bash.

2. For Zsh users run:

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

3. For Bash users run :

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

Verifying the Installation

To confirm that Homebrew is installed correctly:

  1. In Terminal, run:
brew --version
  1. You should see output similar to:
Homebrew 4.3.19
  1. Additionally, you can run a simple update to check everything is working:
   brew update

Troubleshooting Tips

  • Command Not Found Error: If you receive an error saying brew: command not found, double-check that you’ve correctly updated your shell configuration as described in Step 4.
  • Permissions Issues: If you encounter permission errors, ensure you have the necessary rights to /opt/homebrew. You might need to adjust ownership:
sudo chown -R $(whoami) /opt/homebrew
  • Xcode Agreement: Sometimes, you may need to agree to Xcode’s license agreements:
sudo xcodebuild -license accept
  • Rosetta 2 Requirement: Some older packages might require Rosetta 2 to run on Apple Silicon Macs. You can install it with:
softwareupdate --install-rosetta

Conclusion

Congratulations! You’ve successfully installed Homebrew on your Mac with an M1, M2, or M3 chip. You now have access to thousands of open-source packages that can enhance your productivity and streamline your workflow.

Example Usage:

  • Install wget:
brew install wget
  • Search for a package:
brew search package-name
  • Upgrade all installed packages:
brew upgrade

Additional Resources

For any issues not covered in this guide, refer to the Homebrew Troubleshooting page or seek help from the Homebrew community.


Empower your Mac with the versatility of Homebrew and take your macOS experience to the next level!

Leave a Reply

Your email address will not be published. Required fields are marked *