The steps to install Homebrew include: confirming system requirements, installing Xcode command line tools, running official installation commands, and configuring the environment variable PATH. Frequently asked questions: Use sudo chown to fix permissions. Network problems can be switched to DNS. If the command cannot be found, you need to check the PATH configuration. The remaining versions of the old version need to be manually cleaned. Follow the steps to complete the installation smoothly.
Installing Homebrew is actually not difficult. As long as the network and operation steps are fine, you can basically succeed in one go. It is a very practical package management tool that can help you easily install various development tools and command-line programs on your Mac.

Preparation: Ensure the system meets the requirements
Homebrew supports macOS and Linux, here we will only talk about the situation of Mac. First, make sure you are using a Mac with Intel or Apple Silicon (M1/M2, etc.) chip, and you have installed the latest macOS system.
You need administrator permissions because the system directory will be written during installation. If not, go to "System Preferences > Users and Groups" to enable administrator permissions.

In addition, it is recommended to install the Xcode command line tool in advance. Although it is not necessary, many dependency libraries need it to compile:
- Open the terminal and run:
xcode-select --install
Installation steps: Copy and paste the official command
Homebrew officially recommends using the following command to install:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Just copy this command to the terminal and run it. The installation process may vary slightly depending on your system architecture, for example, the Mac of the M1 chip will automatically recognize and install the adapted version.
After the installation is complete, the terminal will prompt you whether you want to add brew
to PATH. If it is zsh (default shell), you can add the path as prompted:
- Edit your shell configuration file (usually
~/.zprofile
or~/.bash_profile
):echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile source ~/.zprofile
This way you can use the brew
command directly.
Frequently Asked Questions and Solutions
Sometimes you will encounter problems with downloads stuck, permission errors or paths that are not well-provided. Here are a few common situations:
- Permission problem : If you see a prompt similar to
/usr/local/
directory permission denied, you can use the following command to fix it:sudo chown -R $(whoami) /usr/local/
- Network problem : Access to GitHub in China may be slow, so you can consider switching DNS, such as 8.8.8.8 or 1.1.1.1.
- Command not found : If you enter
brew
and report an error saying that the command cannot be found, check whether the step of configuring PATH is missed. - Leftovers of old version : If you have installed it before and uninstalled it, it is best to clean up the remaining files and reinstall it.
Basically that's it. Installing Homebrew is not complicated, but some details are easy to ignore, such as shell configuration and permissions issues. As long as you follow it step by step, it will usually be done smoothly.
The above is the detailed content of how to install Homebrew on Mac. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undress AI Tool
Undress images for free

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

This Google translate picture guide shows you how to translate text from an image. If you are looking for more computer tips and solutions, you can visit php.cn Software official website where you can also find some useful computer tools like php.cn

If your Windows 11/10 computer doesn’t automatically the latest versions of device drivers, you will need to manually install them. In this post, php.cn Software will show you 3 different methods to manually install drivers on your device.

This post delivered by php.cn official web page introduces three methods to improve microphone volume and boost its performance, in Control Panel, via Settings, and by Device Manager. Read the below content to view details.

The operating system is the basic software for managing hardware resources, running programs, and providing user interaction interfaces. It coordinates the relationship between hardware and software and is responsible for memory allocation, device scheduling, file management and multitasking. Common systems include Windows (suitable for office and gaming), macOS (Apple devices, suitable for creative work), Linux (open source, suitable for developers), and Android/iOS (mobile device system). The choice of ordinary users depends on the usage scenario, such as software compatibility, security and customization requirements. How to view system information: Use winver command for Windows, click on the machine for macOS, use terminal commands for Linux, and find the phone in settings. The operating system is the underlying tool for daily use,

Have you ever wanted to adjust computer settings to fix some issues but suffered from Control Panel not opening? There is nothing more frustrating than this app not turning on, stopping you from viewing and changing system settings. In this post, mul

This post includes answers for what is dxdiag, how to run dxdiag in Windows 10/11, DirectX Diagnostic Tool’s main functions, and how to update dxdiag.exe driver. php.cn Software also provides many other computer tips and solutions for users. You can

What is Dell Digital Locker? How to log into Dell Digital Locker? This post from php.cn provides answers. Besides, you can know how to use your Dell Digital Locker to find software products included with your Dell computer.

This essay summarized by php.cn Software mainly teaches you how to open Windows 11 Computer Management with Windows Search, Quick Link menu, Run dialog, command prompt, PowerShell, File Explorer, Control Panel, as well as a desktop shortcut.
