Post

Install Homebrew on WSL2

Install HomeBrew on WSL2

  1. Open Ubuntu WSL App
  2. Run Update command
    1
    
    $ sudo apt update
    
  3. Install tool require to setup Brew
    1
    
    $ sudo apt-get install build-essential curl file git
    
  4. Command to Install HomeBrew on WSL Windows 10
    1
    
    $ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
    
  5. Add HomeBrew to your system PATH
    1
    2
    3
    4
    
    $ 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
    
  6. Use Brew on WSL
    1
    2
    
    $ brew -v
    $ brew update
    

References:

This post is licensed under CC BY 4.0 by the author.