Homebrew is a free package deal administration system used to put in, take away, and replace the packages on macOS utilizing terminal instructions. Homebrew simplifies the set up of packages on macOS and assists the builders to streamline their work. This tutorial is a information on how you can set up and use Homebrew on a Mac. Since Homebrew is a terminal-based package deal supervisor you need to know the perform of the terminal on Mac.
Terminal, also called command line interface is an app that permits you to work together with the system in a non-graphical manner. Terminal could be intimidating for anybody who’s new to it however nonetheless it has numerous potential because it allows you to automate duties you carry out in your system.
Homebrew instructions make it simple to put in open-source packages and developer instruments on Macs as Macs don’t include the package deal supervisor. Let’s learn how to put in Homebrew on a Mac:
The next conditions are wanted to put in Homebrew on a Mac:
- A system with macOS (Mojave and later)
- Person with administrative privileges
Learn how to set up Homebrew on Mac
Putting in Homebrew on a Mac is a 2 steps course of:
- Putting in Xcode Command Line Instruments
- Putting in Homebrew
Homebrew performance relies upon upon Xcode Command Line instruments, it must be put in earlier than putting in Homebrew. Let’s learn how to put in Xcode Command Line Instruments Mac.
1: Learn how to set up Xcode Command Line Instruments on Mac
To put in the Homebrew on a Mac you might want to have Xcode Command Line Instruments put in in your system as Homebrew wants these instruments to perform.
Xcode is an IDE from Apple to develop iOS, iPadOS and macOS primarily based functions, whether it is already put in in your system then you definately don’t want to put in Xcode Command Line Instruments. But when it’s not put in then you do not want to put in the complete Xcode IDE as it might take roughly 10GB of storage, as a substitute set up the Xcode Command Line Instruments.
First open terminal in your Mac by urgent Command + Area Bar keys, search terminal after which hit Enter to open it:
Kind the next command to test if the Xcode Command Line Instruments are put in or not:
The above command prints the energetic developer listing, in case you get an error, then meaning the Xcode Command Line Instruments will not be put in:
To put in Xcode Command Line Instruments use the command given beneath:
A dialog field will seem click on Set up:
Agree the License Settlement:
The downloading will start:
Click on Completed when the downloading is completed:
Confirm the set up of Xcode Command Line Instruments utilizing:
To test developer path use:
The Xcode Command Strains Instruments have been put in in your system and now transfer in direction of the following step.
Learn how to Set up Homebrew on Mac
There are two major forms of Macs can be found:
- Intel-based Mac (Intel i5, i7)
- Apple Silicon primarily based Mac (M1/M2)
The method of Homebrew set up on both kind of machines is analogous however Macs primarily based on Apple Silicon require an extra step which shall be mentioned within the following part.
i: Learn how to Set up Homebrew on an Intel-based Mac
Execute the next command within the macOS terminal to start Homebrew package deal supervisor set up:
/bin/bash -c “$(curl -fsSL https://uncooked.githubusercontent.com/Homebrew/set up/HEAD/set up.sh)“
The above script will set up the Homebrew within the /usr/native/ listing.
ii: Learn how to Set up Homebrew on an M1 Mac
The above step will set up Homebrew in /choose/homebrew/ listing if the Mac is Apple Silicon primarily based (M1/M2).
On M1 or M2 Macs there may be an extra step to comply with to put in Homebrew. By default, the Homebrew is downloaded within the /choose/homebrew listing. This listing is just not a part of the atmosphere variable ($PATH).
To make this listing part of atmosphere variable execute the next command on Apple Silicon primarily based Macs:
eval “$(/choose/homebrew/bin/brew shellenv)“
Alternatively, open the zprofile file within the nano editor utilizing command:
Now, add the next line within the file and put it aside:
eval “$(/choose/homebrew/bin/brew shellenv)“
Notice: The Homebrew set up information on this article is for macOS 11.X Huge Sur. Homebrew is just not formally supported on the older variations of macOS, however it might work on macOS Mojave and Catalina.
To confirm the Homebrew set up, use the command given beneath:
To replace the Homebrew to the newest model, use:
For assist associated to Homebrew, execute:
To learn the Homebrew man web page use:
Learn how to Use Homebrew on Mac
Homebrew comes with tons of instructions to handle packages, some generally used instructions are mentioned within the following part:
Putting in Package deal
To put in a system or package deal, use the next syntax:
brew set up <package_name>
Notice: For Homebrew packages system time period is used; it offers directions for Homebrew to put in packages.
For instance, to put in the wget utility exchange the <package_name> with the wget within the above command:
Putting in Casks
You may also set up GUI primarily based apps utilizing Homebrew, for that use the next syntax:
brew set up –cask <package_name>
Notice: To put in the macOS native packages, Homebrew makes use of cask definition.
For instance, to put in Firefox browser, use:
brew set up –cask firefox
Itemizing Put in Packages
To test the put in packages, we will record the Homebrew put in packages utilizing:
To uninstall the Homebrew package deal, comply with the syntax given-below:
brew uninstall <package_name>
To take away wget package deal use:
To take away a cask use the next syntax:
brew uninstall –cask <package_name>
To delete Firefox cask exchange the <package_name>:
brew uninstall –cask firefox
Checking Package deal Dependencies
To test the dependencies of a selected package deal, use the command talked about beneath:
For instance, to test the dependencies of wget, execute:
To replace a selected Homebrew package deal, use the next syntax:
brew replace <package_name>
Itemizing Outdated Packages
To record the outdated packages, use the next command within the terminal:
Eradicating Pointless Dependencies
To take away undesirable dependencies, use:
brew autoremove –dry-run
Itemizing Homebrew Errors and Warnings
To record Homebrew errors and points, use the command given beneath:
Learn how to Uninstall Homebrew from Mac
Should you not want a package deal supervisor on your Mac working macOS Mojave or later then Homebrew can simply be eliminated utilizing the beneath given command:
/bin/bash -c “$(curl -fsSL https://uncooked.githubusercontent.com/Homebrew/set up/HEAD/uninstall.sh)“
Learn how to Uninstall Xcode Command Line Instruments
To uninstall Xcode Command Line Instruments run the command given beneath within the terminal:
sudo rm -rf /Library/Developer/CommandLineTools
macOS doesn’t include any package deal supervisor, many of the software program is put in utilizing GUI. Homebrew is a package deal supervisor that makes it simple to put in packages on macOS via the command line interface. It’s fairly useful in putting in developer instruments and even native macOS open-source GUI functions.