How to install brew on mac
How to install brew on mac
How to install brew on mac
Copy raw contents
Instructions for a supported install of Homebrew are on the homepage.
Git Remote Mirroring
You can use geolocalized Git mirrors to speed up Homebrew’s installation and brew update by setting HOMEBREW_BREW_GIT_REMOTE and/or HOMEBREW_CORE_GIT_REMOTE in your shell environment with this script:
The default Git remote will be used if the corresponding environment variable is unset.
Linux or Windows 10 Subsystem for Linux
Just extract (or git clone ) Homebrew wherever you want. Just avoid:
However do yourself a favour and use the installer to install to the default prefix. Some things may not build when installed elsewhere. One of the reasons Homebrew just works relative to the competition is because we recommend installing here. Pick another prefix at your peril!
Create a Homebrew installation wherever you extract the tarball. Whichever brew command is called is where the packages will be installed. You can use this as you see fit, e.g. to have a system set of libs in the default prefix and tweaked formulae for development in
If you want a non-interactive run of the Homebrew installer that doesn’t prompt for passwords (e.g. in automation scripts), prepend NONINTERACTIVE=1 to the installation command.
Uninstallation is documented in the FAQ.
1 For 32-bit or PPC support see Tigerbrew.
2 10.15 or higher is recommended, while 10.11–10.14 are supported on a best-effort basis. For 10.4–10.6 see Tigerbrew.
3 Most formulae require a compiler. A handful require a full Xcode installation. You can install Xcode, the CLT, or both; Homebrew supports all three configurations. Downloading Xcode may require an Apple Developer account on older versions of Mac OS X. Sign up for free at Apple’s website.
Homebrew Documentation
Instructions for a supported install of Homebrew are on the homepage.
macOS Requirements
Git Remote Mirroring
You can use geolocalized Git mirrors to speed up Homebrew’s installation and brew update by setting HOMEBREW_BREW_GIT_REMOTE and/or HOMEBREW_CORE_GIT_REMOTE in your shell environment with this script:
The default Git remote will be used if the corresponding environment variable is unset.
Alternative Installs
Linux or Windows 10 Subsystem for Linux
Untar anywhere
Just extract (or git clone ) Homebrew wherever you want. Just avoid:
However do yourself a favour and use the installer to install to the default prefix. Some things may not build when installed elsewhere. One of the reasons Homebrew just works relative to the competition is because we recommend installing here. Pick another prefix at your peril!
Multiple installations
Create a Homebrew installation wherever you extract the tarball. Whichever brew command is called is where the packages will be installed. You can use this as you see fit, e.g. to have a system set of libs in the default prefix and tweaked formulae for development in
Unattended installation
If you want a non-interactive run of the Homebrew installer that doesn’t prompt for passwords (e.g. in automation scripts), prepend NONINTERACTIVE=1 to the installation command.
Uninstallation
Uninstallation is documented in the FAQ.
1 For 32-bit or PPC support see Tigerbrew.
2 10.15 or higher is recommended, while 10.11–10.14 are supported on a best-effort basis. For 10.4–10.6 see Tigerbrew.
3 Most formulae require a compiler. A handful require a full Xcode installation. You can install Xcode, the CLT, or both; Homebrew supports all three configurations. Downloading Xcode may require an Apple Developer account on older versions of Mac OS X. Sign up for free at Apple’s website.
How to Install Homebrew on Mac
Advanced Mac users may appreciate using the Homebrew package manager, which greatly simplifies the process of installing command line software and tools on a Mac.
For example, if you want to easily install favorite command line tools on a Mac like cask, htop, wget, nmap, tree, irssi, links, colordiff, or virtually any other familiar unix command line utility, you can do so with a simple command. Homebrew downloads and builds the package for you.
This is obviously aimed at more technically savvy Mac users who spend a lot of time at the command line. While there’s no particular issue for novice users installing Homebrew on their Mac, the odds of novices finding it useful are slim, unless they intend to embark on learning the command line environment. Contrast that to power users who practically live in a terminal environment, whether longtime Mac users or migrating to the platform from the Windows or Linux world, who will immediately see the value of Homebrew.
Requirements for Installing Homebrew on Mac OS
prerequisites to installing Homebrew on a Mac include the following:
Assuming you’re interested in installing Homebrew and meet those requirements, then the rest is equally straight forward.
How to Install Homebrew on Mac OS
The simplest way to install Homebrew is through ruby and curl, accomplished with a single command. This approach is the same for installing Homebrew in all supported versions of Mac OS and Mac OS X.
Installation of Homebrew will take a while depending on the speed of your Mac and internet connection, as each necessary package is downloaded and installed by the script.
When complete, you will see an “Installation successful!” message.
Now you’re ready to install software packages through Homebrew, or you can read the help documentation with the following command:
Installing Software Packages through Homebrew on Mac
Installing packages with Homebrew is super easy, just use the following syntax:
brew install [package name]
For example, to install wget through Homebrew you could use the following syntax:
brew install wget
Simple, easy. Once complete you can run wget as usual.
A quick side note; Homebrew is not the only way to install command line software, you can install command line tools on a Mac yourself and then compile and make software independently. For example, we discuss installing wget on Mac OS without Homebrew here and it uses the typical configure and make process. There’s nothing wrong with that approach (and arguably it might be preferable for users who want limited packages and a slimmer footprint) but if you’re accustomed to a package manager like dpkg, apt-get, or rpm you’ll almost certainly appreciate and prefer to use Homebrew.
How to Disable Homebrew Analytics Tracking
Homebrew now defaults to using anonymized behavioral analytics tracking. If you do not want to participate in that or you’d just rather disable the feature to reduce network traffic or for privacy purposes, or whatever other reason, you can run the following command after successfully installing Homebrew on a Mac. This will opt out of Homebrew analytics:
brew analytics off
Hit return and after a moment or so the analytics tracking in Homebrew will be disabled.
How to Remove HomeBrew from a Mac
If you have installed Homebrew but later decide you want to remove Homebrew from a Mac for some reason or another, you can uninstall it with another ruby script run from the command line, choose the script that aligns with your version of MacOS:
Removing Homebrew in MacOS Catalina, macOS Big Sur, and MacOS Mojave:
Alternatively, you could download that “uninstall” script directly and run it yourself.
How to install homebrew on M1 mac
I just got a new Mac, the M1 Macbook pro and I am trying to install homebrew, but every time I finish installing it, it tells me that it was not written to the path, and then when I try the advised whatever to add to the path, nothing happens and the terminal or whatever does not recognize the command at all, as if it isn’t installed.
11 Answers 11
Trending sort
Trending sort is based off of the default sorting method — by highest score — but it boosts votes that have happened recently, helping to surface more up-to-date answers.
It falls back to sorting by highest score if no posts are trending.
Switch to Trending sort
Homebrew installation on apple silicon, step by step:
In my case, installation show me errors, I just installed again, and then show: Installation successful!, and warning: /opt/homebrew/bin is not in your PATH
This works for me to path homebrew permanently.
Seems Touch, source and export not required now. Run the below command in terminal
and follow the instructions showing in terminal itself. shows as follows:
Go to Homebrew and get the install command:
When requsted in the Terminal press ‘return’ to finish installation
After installation, the Terminal generates the next commands to be executed:
open the terminal and copy below command
create new empty file with touch
now open the file with vim editor
now enter i to start edit mode and write
then press esc and type :wq
now we setup brew successfully for permanently to test enter
brew or brew help
Go To the home brew webpage
copy the script provided under Install Homebrew
Open Terminal via spotlight search
Then open the terminal in the using the spotlight search by pressing the command + spacebar
now in the terminal paste the script which was copied from the homebrew site
it will ask to click return button after some time so don’t worry after successful installation the brew won’t work as for M1 Chip MacBook air.
It will show some warning for the path i.e. warning: /opt/homebrew/bin is not in your PATH
So Run the command to create this directory i.e.
Now we will open the home directory
To open home directory we will open the finder from the dock and make sure its the active application
now in the finder app we will press button to open the home directory i.e. command+shift+H
After this finder will open the home directory
Now we will make this file available
So type paste this code in the terminal
After this command run one more command on the terminal to check if the howebrew is working fine
On typing this you will get to know that home brew is now working!!
Now do what ever you want to do using brew either install git or any other things which you want.
Marcin PilЕ›niak
Brew on macOS Explained In 1 Post
What is a brew/homebrew?
If you used a Linux before, you had to meet apt-get on Debian/Ubuntu system or yum on Centos/Red Hat. Brew as well as these tools is a package manager that allows you to install (most of) Linux ‘s libs and tools on your Mac! You can also create your own packages to easily install them on other Macs.
It can be interesting that even Microsoft noticed the values behind packages managers. They introduced it to Windows. I was really surprised when I read it.
Let’s leave Windows, and focus and MacOs/OSX. It’s worth to mention, that the following information and instructions are valid on High Sierra, Mojave, and Catalina.
Install
So, it’s very easy. Everything that you need is the Terminal. When you ran it, copy and paste the following lines:
What does that code do?
1. Fetch a shell script from the following URL: https://raw.githubusercontent.com/Homebrew/install/master/install
2. Execute it
How to use?
What does it do? Install apache2 on your Mac of course.
And that’s it! The newest version of apache2 has been installed and is ready to use.
How to remove the not used library?
Sometimes we need to install some libraries, but we need them only temporarily. When we finish our job, we can do remove them from our Mac.
Brew shared with you a set of different commands (aliases) to do that. Let’s stick to our apache2 example.
When you do that, it’s worth to run the following command to remove the rubbish as well.
Alternatives
They do not exist! Yes, I’m just kidding, before “the brew ages” there was something called macport. Those tools have still more available packages but brew is easier and more popular now.
Keep brew always up to date
The software contains bugs, security vulnerabilities, or can be just incompatible with your version of macOs. This is the reason why it’s worth keeping all libraries, and brew as well, updated.
To keep brew and libraries always updated, you have to use the following commands:
Brew and different versions of PHP
How to install PHP 7.4 with brew
The newest version of PHP. It includes support for PDO, MySQL, PostgreSQL, phpdbp, mbstring, soap, sqlite and much more.
How to install PHP 7.3 with brew
Be aware! If you have to support a current project without a possibility to upgrade to PHP 7.4 you can install it, but active support is planned until the 6th of December 2020.
How to install PHP 7.2 with brew
Important! You shouldn’t install this version of PHP. There is no active support anymore. The security support is planned utill the 30th of November 2020.
How to use different version of PHP at the same time?
As a developer, you have many different projects. Probably each of them requires different versions of PHP. With brew it’s really easy to use all of them without switching configuration, restarting notebook, or touching any services. You need aliases.
Voila, to verify is it work you have to restart terminal andy try to execute next commands.
If everything works fine, you should see something similar to:
Brew + PHP + Composer
If you are interested in extra methods of installing Composer you can check my other note. You will find there brew, docker, and direct method to install Composer.
Problems
Do you have a problem? Just run another command brew doctor which shows you potential problems and propositions on how to fix them.
bash: brew: command not found
Have you got this message “command not found”? It means you have to install brew. How to do that? Just scroll up to section “Install”.