Linuxbrew-core: Unable to install Homebrew (Linuxbrew) on WSL (Windows 10 Pro Verison 1903 build 18362.418)

Created on 12 Oct 2019  ·  5Comments  ·  Source: Homebrew/linuxbrew-core

Please note we will close your issue without comment if you delete, do not read or do not fill out the issue checklist below and provide ALL the requested information. If you repeatedly fail to use the issue template, we will block you from ever submitting issues to Homebrew again.

  • [x] are reporting a bug others will be able to reproduce and not asking a question or requesting software. If you're not sure or want to ask a question do so on our Discourse: https://discourse.brew.sh. To get software added or changed in Homebrew please file a Pull Request
  • [ ] have a problem with brew install (or upgrade, reinstall) a single, Homebrew/homebrew-core formula (not cask) on macOS? If it's a general brew problem please file this issue at Homebrew/brew: https://github.com/Homebrew/brew/issues/new/choose. If it's a Linux problem please file this issue at https://github.com/Homebrew/linuxbrew-core/issues/new/choose. If it's a brew cask problem please file this issue at https://github.com/Homebrew/homebrew-cask/issues/new/choose. If it's a tap (e.g. Homebrew/homebrew-php) problem please file this issue at the tap.
  • [ ] ran brew update and can still reproduce the problem?
  • [ ] ran brew doctor, fixed all issues and can still reproduce the problem?
  • [ ] ran brew gist-logs <formula> (where <formula> is the name of the formula that failed) and included the output link?
  • [ ] if brew gist-logs didn't work: ran brew config and brew doctor and included their output with your issue?

To help us debug your issue please explain:

  • What you were trying to do (and why)
    I am attempting to install linuxbrew on WSL using the method listed on the Homebrew docs for Linux & WSL

  • What happened (include command output)
    I followed the instructions at the top of the page referenced above:
    sh -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)
    ```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


When I ran the first command `sh -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)"`, I received the message that the installation was successful and to add Ruby to my path. However I also received a message that states `-e:199: warning: Insecure world writable dir /mnt/c in PATH, mode 040777`

As per [WSL issue # 1426](https://github.com/Microsoft/WSL/issues/1426), this being in my PATH serves as interoperability between WSL and Windows. So I'm assuming this can be ignored. I don't know if this is the root of the issue.

I was able to come across no issues following the installation instructions until I used this command: `test -d /home/linuxbrew/.linuxbrew && eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)`

I checked the path and saw that there wasn't a ~/.linuxbrew directory.

After researching, I removed the newly created files and directories and attempted to install Homebrew using this method from issue [#849](https://github.com/Linuxbrew/brew/issues/849#issuecomment-424146132): `HOMEBREW_FORCE_VENDOR_RUBY=1 sh -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)"`

This ended up having the same results as using the inital `sh -c` command referenced above.

I deleted the newly created files and directories and I then tried the alternative installation referenced at the bottom of the docs page.

git clone https://github.com/Homebrew/brew ~/.linuxbrew/Homebrew
mkdir ~/.linuxbrew/bin
ln -s ../Homebrew/bin/brew ~/.linuxbrew/bin
eval $(~/.linuxbrew/bin/brew shellenv)
```

I was able to clone it however when I got down to the eval command I received a message stating Error: Running Homebrew as root is extremely dangerous and no longer supported. As Homebrew does not drop privileges on installation you would be giving all build scripts full access to your system.

I manually checked and saw that there was a brew file that was created but no shellenv file.

I entered the brew command to see if it would work but I received the message The program 'brew' is currently not installed. You can install it by typing: apt install linuxbrew-wrapper

This is where I stopped.

Windows 10 Pro Verison 1903 build 18362.418
Bash Version: GNU bash, version 4.3.48(1)-release (x86_64-pc-linux-gnu)
Ubuntu 16.04.5 LTS

  • What you expected to happen
    linuxbrew should be installed.
  • Step-by-step reproduction instructions (by running brew install commands)
    I was unable to do this since homebrew did not install.
outdated question

All 5 comments

Please report the output of…

sh -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)
ls -l /home/linuxbrew/.linuxbrew/bin/brew
eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)
which -a brew
brew --version

Hey @sjackman,
please see below for my output.

Please let me know if there is a better way to format this.

$ sh -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)"                           ==> Installing Ruby to /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor                                        % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current                                                                          Dload  Upload   Total   Spent    Left  Speed                                             0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0                                          100 26.9M  100 26.9M    0     0  2293k      0  0:00:12  0:00:12 --:--:-- 2995k                                          ==> Installing successful                                                                                               ==> /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/portable-ruby/current/bin/ruby                          ruby 2.3.7p456 (2018-03-28 revision 63024) [x86_64-linux]                                                               ==> Add Ruby to your PATH by running:                                                                                   PATH=/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/portable-ruby/current/bin:$PATH
-e:199: warning: Insecure world writable dir /mnt/c in PATH, mode 040777
Don't run this as root!

$ root@PC❯ ls -l /home/linuxbrew/.linuxbrew/bin/brew                                                                             ls: cannot access '/home/linuxbrew/.linuxbrew/bin/brew': No such file or directory
$ root@PC❯ eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)                                                                  zsh: no such file or directory: /home/linuxbrew/.linuxbrew/bin/brew

$ root@PC❯ which -a brew                                                                                                         
brew not found

$ root@PC❯ brew --version                                                                                                        
zsh: command not found: brew
Don't run this as root!

I believe that the default user in WSL should be your user and not root. In any case, before installing and running Homebrew on Linux, switch from root to a normal user, perhaps using su or sudo, or by reviewing the WSL documentation to figure out why you're root, when the default is non-root, as far as I know.

I've closed this issue, but feel free to comment.

Don't run this as root!

I believe that the default user in WSL should be your user and not root. In any case, before installing and running Homebrew on Linux, switch from root to a normal user, perhaps using su or sudo, or by reviewing the WSL documentation to figure out why you're root, when the default is non-root, as far as I know.

This solved it for me. Thank you so much.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

davideo picture davideo  ·  4Comments

vkyt picture vkyt  ·  4Comments

iMichka picture iMichka  ·  6Comments

oliver-la picture oliver-la  ·  7Comments

estraph picture estraph  ·  7Comments