- Homebrew Documentation
- macOS Requirements
- Git Remote Mirroring
- Alternative Installs
- Linux or Windows 10 Subsystem for Linux
- Untar anywhere
- Multiple installations
- Uninstallation
- Using Brew on Windows 10 with Windows Subsystem for Linux (WSL)
- Enable WSL and Install Ubuntu
- Install and Configure brew
- Error: patchelf fix
- Usage Notes
- Homebrew
- 02 February 2019
- MikeMcQuaid
- How to run “brew” command in windows.
- 5 Answers 5
Homebrew Documentation
Instructions for a supported install of Homebrew are on the homepage.
This script installs Homebrew to its preferred prefix ( /usr/local for macOS Intel, /opt/homebrew for Apple Silicon) so that you don’t need sudo when you brew install . It is a careful script; it can be run even if you have stuff installed in /usr/local already. It tells you exactly what it will do before it does it too. You have to confirm everything it will do before it starts.
macOS Requirements
- A 64-bit Intel CPU or Apple Silicon CPU 1
- macOS Mojave (10.14) (or higher) 2
- Command Line Tools (CLT) for Xcode: xcode-select —install , developer.apple.com/downloads or Xcode3
- A Bourne-compatible shell for installation (e.g. bash or zsh ) 4
Git Remote Mirroring
You can set HOMEBREW_BREW_GIT_REMOTE and/or HOMEBREW_CORE_GIT_REMOTE in your shell environment to use geolocalized Git mirrors to speed up Homebrew’s installation with this script and, after installation, brew update .
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:
- Directories with names that contain spaces. Homebrew itself can handle spaces, but many build scripts cannot.
- /tmp subdirectories because Homebrew gets upset.
- /sw and /opt/local because build scripts get confused when Homebrew is there instead of Fink or MacPorts, respectively.
However do yourself a favour and install to /usr/local on macOS Intel, /opt/homebrew on macOS ARM, and /home/linuxbrew/.linuxbrew on Linux. 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. a system set of libs in /usr/local and tweaked formulae for development in
Uninstallation
Uninstallation is documented in the FAQ.
1 For 32-bit or PPC support see Tigerbrew.
2 10.14 or higher is recommended. 10.9–10.13 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 here.
Using Brew on Windows 10 with Windows Subsystem for Linux (WSL)
Feb 25, 2019 · 4 min read
There’s just something poetic about using brew in Ubuntu’s GNU bash shell running on a Linux compatibility layer in Windows 10… natively. And it works surprisingly well.
Windows Subsystem for Linux (WSL) is a Windows 10 feature that provides native support for the Linux/GNU environment. When enabled, you are able to download and run the command line interface for various Linux distributions as a Windows app.
The recent release of Homebrew 2.0 brings official support for Linux and Windows 10 (through WSL). This is based on a fork of Homebrew known as Linuxbrew.
Enable WSL and Install Ubuntu
From th e Windows start menu, open Turn Windows features on or off. Click the checkbox for Windows Subsystem for Linux, and your computer will take a few minutes to download and install the necessary files. You’ll be prompted to restart (make sure to bookmark this article!).
Next, open Microsoft Store and search for Linux. Select Show all next to Apps and you’ll see a list of distros to pick from including Kali, Ubuntu, Ubuntu LTS, and Debian.
I picked Ubuntu. It will take a few minutes to install after it is downloaded (
After creating a user account, you’ll be able to launch Ubuntu as an app, which will open a command line window to its bash shell.
Go ahead and convince yourself you are actually running a Linux bash shell in Windows 10. (Try which $SHELL , uname -o , or ls -al / ).
Install and Configure brew
Run the following to install brew as Linuxbrew. Note: right-clicking in the window will paste and run your clipboard contents.
Pay close attention to the output; you’ll be instructed to Configure Linuxbrew in your
.profile and Add Linuxbrew to your PATH. Normally, Homebrew on MacOS will install packages to /usr/local/bin or /usr/local/Cellar . Linuxbrew, on the other hand, will install packages to /home/linuxbrew/.linuxbrew/bin . Therefore, you will need to manually add that directory to your PATH. Additionally, this means that you won’t need to use sudo to use brew .
Run these commands:
And that’s it! Now you can use brew ! Try installing a simple package to test:
You should get the below output if everything is working as expected. If you get an error concerning patchelf , see below for a fix. Otherwise, you can skip ahead to “Usage Notes”.
Error: patchelf fix
If you have the following error:
The recommended solution of brew install gcc may result in the same error. A fix is to run the following commands to get brew working properly.
Usage Notes
So how is the file system set up? If you cd
and pwd , you’ll get /home/ / … but that can’t really be the path from / ! The root directory for your Linux filesystem should look something like the following.
I recommend bookmarking this in Windows Explorer.
How do I access Windows files? The operating system drive folder will appear in /mnt/ most likely as /mnt/c/ .
Homebrew compatibility. I found some apps that didn’t work well from apt-get worked flawlessly when installed with brew , like zplug . Inversely, I couldn’t get ranger to work with brew but got it working with apt-get . This very conveniently gives you multiple options for installing a package, potentially skipping the step of Googling vague errors.
What can I do if I mess up? If you mess something up badly, you can just uninstall and reinstall the Linux application to quickly start everything over.
Can I use a shell other than bash ? Yup! I personally set up zsh . Here’s a tip: I had problems setting the default shell to zsh after installing it. Instead of installing zsh directly from source, installing it through oh-my-zsh worked fine. In addition, I had to source
/.profile in my .zhsrc file for Linuxbrew to work properly.
This definitely makes the transition from MacOSX to Windows development much friendlier! Thanks for reading!
Homebrew
02 February 2019
MikeMcQuaid
Today I’d like to announce Homebrew 2.0.0. The most significant changes since 1.9.0 are official support for Linux and Windows 10 (with Windows Subsystem for Linux), brew cleanup running automatically, no more options in Homebrew/homebrew-core, and removal of support for OS X Mountain Lion (10.8) and older.
Major changes and deprecations since 1.9.0:
- Homebrew officially supports Linux and Windows 10 with Windows Subsystem for Linux (WSL). Homebrew on Linux was previously called “Linuxbrew”. You can install it in your home directory, so it does not require sudo , and use it to install software that your host distribution’s package manager does not provide. Homebrew on Linux uses its own repository for formulae: Homebrew/linuxbrew-core
- brew cleanup is run periodically (every 30 days) and triggers for individual formula cleanup on reinstall, install or upgrade. You can opt-out of this behaviour by setting the HOMEBREW_NO_INSTALL_CLEANUP variable. This addresses a long-standing complaint where users were surprised by how much disk space Homebrew used if they did not run brew cleanup .
- Homebrew does not run on OS X Mountain Lion (10.8) and below. For 10.4 — 10.6 support, see Tigerbrew. This has allowed us to remove large amounts of legacy code.
- Homebrew does not migrate old, pre-1.0.0 installations from the Homebrew/legacy-homebrew (formerly Homebrew/homebrew repository. This has allowed us to delete legacy code that dealt with migrations from old versions.
- Homebrew does not have any formulae with options in Homebrew/homebrew-core. Options will still be supported and encouraged by third-party taps. This change allows us to better focus on delivering binary packages rather than options. Formulae with options had to be built from source, could not be tested on our CI system and provided a disproportionate support burden on our volunteer maintainers.
Other changes since 1.9.0 I’d like to highlight are the following:
Also, if you’ve not tuned in since 1.0.0, here are the major changes since then:
- Rubocop-supporting editors (e.g. VS Code, Atom) can get inline brew audit information when editing formulae in taps. This improves the contribution experience.
- A brew tap-new command is available for creating a new tap with a READMEand preconfigured Azure Pipelines configuration (which seems to provide the most reliable and performant macOS CI for OSS at the time of writing). This eases the creation of taps (third-party repositories).
- brew update-reset resets all repositories and taps to their upstream versions. This is useful when debugging git issues.
- brew link state is preserved after brew install and brew upgrade (including for keg-only formulae) but unfortunately not the brew unlink state due to a lack of state. This should allow many keg-only formulae to be used as if they are normal formulae.
- Homebrew filters all user environment variables. This reduces errors when formulae are built from source and allows the removal of many workarounds for niche issues.
- brew postgresql-upgrade-database upgrades PostgreSQL database data between major versions. This simplifies upgrades between PostgreSQL versions which previously required a semi-manual process and old version of PostgreSQL to be kept around.
- The python formula was upgraded to Python 3.x and python@2 formula was added for installing Python 2.7. We initially did not comply with PEP 394 and this was a mistake. We made brew install python and brew install python@2 PEP 394 compliant and will not change this again until PEP 394 has changed. This allows us to migrate more of our ecosystem to Python 3.
- We deprecated and archived all the Homebrew organisation taps and created new and versioned formulae in Homebrew/homebrew-core. We encourage more niche formulae and formula options to be supported in taps outside the Homebrew organisation. This allows us to focus on providing high-quality formulae that work consistently rather than a long-tail of broken, unsupported, ignored formulae.
- Homebrew Formulae is a site providing formulae data, anonymous aggregate analytics data and a JSON API querying these. This allows you to quickly query Homebrew information without access to macOS or Homebrew.
- In July 2018 a security researcher identified a GitHub personal access token leak from Homebrew’s Jenkins. Within a few hours the credentials had been revoked and sanitised. No packages were compromised and no action was required by users due to this incident. We are currently attempting to migrate away from Jenkins to a suitable hosted CI provider.
- When a bottle isn’t available for your version of macOS we will use a bottle from an older version instead. This will make life much more pleasant on new macOS releases before our bottling has completed (or when formulae fail to build).
- brew upgrade automatically reinstalls or upgrades formulae with broken linkage. This avoids broken formulae when building from source or using optional behaviour after upgrades.
- brew info displays analytics data. This is the way that Homebrew maintainers query analytics data so we are using the same data as the community.. This will hopefully ease concerns about our collection of analytics data.
- Homebrew Cask’s downloads are quarantined. This provides the same level of security when downloading these tools manually.
- Homebrew/homebrew-core requires all formulae to be open source by the OSI definition. This allows you to be confident that any brew install (although not brew cask install ) from Homebrew/homebrew-core is open source software.
- brew link —force will not link software already provided by macOS but instead output the instructions on how to do so. This avoids strange compilation errors and encourages users to use the system mechanisms for adjusting their PATH .
- Many Homebrew maintainers will be attending FOSDEM 2019 (say hello!) and meeting afterwards on 4th February to discuss the future governance of Homebrew.
- Homebrew still accepts donations through Patreon. If you can afford it, please consider donating. If you’d rather not use Patreon (our preferred donation method), check out the other ways to donate in our README.
Thanks to all our hard-working maintainers, contributors, sponsors and supporters for getting us this far. Enjoy using Homebrew!
How to run “brew” command in windows.
It shows «‘brew’ is not recognized as an internal or external command» in windows command prompt.
I am trying to install codeigniter-reactjs-example from github, where first command is brew . How to run this command to install that project in Windows.
5 Answers 5
Homebrew is MacOSX only command line installer application and it doesn’t exist for Windows.
The Windows alternatives are:
- Chocolatey
- Npackd
- Scoop
- OneGet for Windows 10
It shows «‘brew’ is not recognized as an internal or external command» in windows command prompt.
Not anymore, 19 months later (Feb. 2019, compared to July 2017)
Homebrew 2.0.0 has been released (at @FOSDEM!) with official Linux and Windows 10 WSL support, brew cleanup running automatically (opt-out with HOMEBREW_NO_INSTALL_CLEANUP ), no more options in Homebrew/core and no longer running on OS X 10.8 and older.
“Homebrew on Linux” is called “ Linuxbrew ”.
You can install it in your home directory, so it does not require sudo , and use it to install software that your host distribution’s package manager does not provide. Linuxbrew uses its own repository for formulae: Linuxbrew/homebrew-core .
So again, this is not native Windows support, but Linux (through the WSL layer, on Windows 10).