Skip to content

Instantly share code, notes, and snippets.

@dsmith73
Last active May 28, 2024 07:59
Show Gist options
  • Save dsmith73/9f48379e81768dc43d49753900e5c773 to your computer and use it in GitHub Desktop.
Save dsmith73/9f48379e81768dc43d49753900e5c773 to your computer and use it in GitHub Desktop.
install homebrew on wsl

Installing homebrew / Linuxbrew on Ubuntu-18.04 wsl for Windows 10


open wsl command line

type -

sh -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)"  

You will need to manually add the directory to your PATH.

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

If you have the following error:

Error: patchelf must be installed: brew install patchelf
Warning: Bottle installation failed: building from source.
Error: The following formula
  patchelf
cannot be installed as binary package and must be built from source.

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.

sudo apt-get update  
sudo apt-get install build-essential  

Why did I want to do this?

I'm tired of needing to manually log into github to create a repo, copy the clone url, and making the initial clone to my computer, so that I can start working on a project. It would be so much simpler to just create the repo from the terminal and push up the data as I build...

So this allows me to brew install hub and remotely create github repos from the terminal
hub create -d "<commit name>"

In my book, that's a WIN


Links:


#dsmith73
github.com/dsmith73
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment