Last updated: Apr 4, 2024
Reading time·4 min

The 3 most common options for installing Homebrew on Windows are:
To install Windows Subsystem for Linux and Homebrew on Windows:
Click on the Search bar and type CMD.
Right-click on the Command Prompt application and click "Run as administrator".

wsl --install -d Ubuntu command.wsl --install -d Ubuntu

wsl --list --online command if you want to list all valid
distributions that can be installed.wsl --list --online # 👇️ the syntax for the installation command wsl --install -d DISTRO_NAME

wsl command is not recognized, use the older
lxrun command instead.lxrun /install


Close your CMD and PowerShell sessions and reopen your shell as an administrator.
Now you can simply type bash in CMD to start a bash shell.
Run the following commands.
bash sudo apt-get update sudo apt-get install build-essential procps curl file git

Now you can use the following command to install Homebrew.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

bash command to enter a bash session before issuing Unix commands.test -d ~/.linuxbrew && eval "$(~/.linuxbrew/bin/brew shellenv)" test -d /home/linuxbrew/.linuxbrew && eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" test -r ~/.bash_profile && echo "eval \"\$($(brew --prefix)/bin/brew shellenv)\"" >> ~/.bash_profile echo "eval \"\$($(brew --prefix)/bin/brew shellenv)\"" >> ~/.profile

brew.brew install hello


To install Windows Subsystem for Linux and Homebrew using Microsoft Store:
Click on the https://aka.ms/wslstore link.
In the Microsoft Store window, use the Search bar to look for your Linux distribution of choice. For example, Ubuntu 22.04.1 LTS.





After the process is complete, you can click on the Search bar and type "Ubuntu" to start your integrated Linux environment.

Now you can simply type bash in CMD to start a bash shell. Run the following
commands.
bash sudo apt-get update sudo apt-get install build-essential procps curl file git

Now you can use the following command to install Homebrew.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

bash command to enter a bash session before issuing Unix commands.test -d ~/.linuxbrew && eval "$(~/.linuxbrew/bin/brew shellenv)" test -d /home/linuxbrew/.linuxbrew && eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" test -r ~/.bash_profile && echo "eval \"\$($(brew --prefix)/bin/brew shellenv)\"" >> ~/.bash_profile echo "eval \"\$($(brew --prefix)/bin/brew shellenv)\"" >> ~/.profile

brew.brew install hello

To install Chocolatey, a Homebrew alternative for Windows:

Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))

choco to make sure Chocolatey is installed.
Now that Chocolatey is installed, you can install a package with the
choco install command.
Here is an example command that installs wget.
choco install wget -y

Note that your shell should still be run using elevated permissions.
Now you should be able to use the wget command.
wget https://google.com -o out.html
You can learn more about the related topics by checking out the following tutorials: