- 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 Documentation
- macOS Requirements
- Git Remote Mirroring
- Alternative Installs
- Linux or Windows 10 Subsystem for Linux
- Untar anywhere
- Multiple installations
- Uninstallation
- How to install brew on windows
- How to run “brew” command in windows.
- 5 Answers 5
- How To Install Brew On Windows
- How to install Homebrew on Windows Subsystem for Linux on
- How to install Brew on WSL- Windows subsystem for Linux
- How to Use Homebrew to Install Software on Linux and Windows
- Tips and Tricks — Homebrew Documentation
- 5 Ways to install Node.js
- Command-line tools for Kubernetes: kubectl, stern, kubectx
- 2.0.0 — Homebrew
- How to install Linuxbrew
- The Missing Package Manager for macOS (or Linux) — Homebrew
- How to Install and Use Homebrew
- PostgreSQL Tips: Installing the PostgreSQL Client IBM
- How to Install VirtualBox Extension Pack on Mac, Windows
- PostgreSQL Tips: Installing the PostgreSQL Client
- (Tutorial) How to Install R on Windows, Mac OS X, and
- Getting Started — PyGObject
- The eksctl command line utility
- 7 Awesome Rust-powered Command-line Utilities by
- How to Install an Older Brew Package by Nassos Michas
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 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.
How to install brew on windows
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.
- 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.
Linux or Windows 10 Subsystem for Linux
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!
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 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.
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).
How To Install Brew On Windows
How to install Homebrew on Windows Subsystem for Linux on
› Verified 5 days ago
How to install Brew on WSL- Windows subsystem for Linux
› Verified Just Now
How to Use Homebrew to Install Software on Linux and Windows
› Verified 1 days ago
Tips and Tricks — Homebrew Documentation
› Verified 5 days ago
5 Ways to install Node.js
› Verified 8 days ago
Command-line tools for Kubernetes: kubectl, stern, kubectx
› Verified 9 days ago
2.0.0 — Homebrew
› Verified 2 days ago
How to install Linuxbrew
› Verified 6 days ago
The Missing Package Manager for macOS (or Linux) — Homebrew
› Verified 6 days ago
How to Install and Use Homebrew
› Verified 5 days ago
PostgreSQL Tips: Installing the PostgreSQL Client IBM
› Verified 9 days ago
How to Install VirtualBox Extension Pack on Mac, Windows
› Verified Just Now
PostgreSQL Tips: Installing the PostgreSQL Client
› Verified 2 days ago
(Tutorial) How to Install R on Windows, Mac OS X, and
› Verified 6 days ago
Getting Started — PyGObject
› Verified 3 days ago
The eksctl command line utility
› Verified Just Now
7 Awesome Rust-powered Command-line Utilities by
› Verified 6 days ago
How to Install an Older Brew Package by Nassos Michas
, and that’s all. A few seconds later, Homebrew will pick the correct version of the package matching …