How to Use Homebrew on Ubuntu

Can I use Homebrew on Ubuntu?

I just tried installing it using the ruby command but somehow the dependencies are not resolved hence brew does not completely install. But, try installing by cloning:

git clone https://github.com/Homebrew/linuxbrew.git ~/.linuxbrew

and then add the following to your .bash_profile:

export PATH="$HOME/.linuxbrew/bin:$PATH"
export MANPATH="$HOME/.linuxbrew/share/man:$MANPATH"
export INFOPATH="$HOME/.linuxbrew/share/info:$INFOPATH"

It should work..

How to Install Homebrew on Windows WSL Ubuntu, and fix zsh: brew command not found error

In a wsl environment, brew is installed at location: /home/linuxbrew/.linuxbrew/ which is not part of the path.

So we simply need to add that to path, and it works. I am using zsh as my shell, so I add these lines to my ~/.zshrc file (in ubuntu file system) :

export BREW_HOME="/home/linuxbrew/.linuxbrew/bin"
export PATH="$PATH:$BREW_HOME"

How to install homebrew on Ubuntu inside Docker container

Is there a reason you can't use the official image (docker pull linuxbrew/linuxbrew)? It is based on Ubuntu 16.04 / Xenial.

If you must use Bionic (18.04), the correct way to install homebrew will be to follow the steps in the official Dockerfile.

But to get your Dockerfile working, you need to install ruby, create a non-root user and execute the installation script as that user. Like so,

FROM ubuntu:18.04

RUN apt-get update && \
apt-get install build-essential curl file git ruby-full locales --no-install-recommends -y && \
rm -rf /var/lib/apt/lists/*

RUN localedef -i en_US -f UTF-8 en_US.UTF-8

RUN useradd -m -s /bin/bash linuxbrew && \
echo 'linuxbrew ALL=(ALL) NOPASSWD:ALL' >>/etc/sudoers

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

USER root
ENV PATH="/home/linuxbrew/.linuxbrew/bin:${PATH}"

PS: I have added --no-install-recommends to ignore optional dependencies and rm -rf /var/lib/apt/lists/* to remove apt-get leftovers thus reducing the image size. Also, locales is added to install UTF-8 or brew will throw a warning when you run the command.

How to Fix Howbrew path issue permanently in ubuntu

Just had the same error. I think it was, because I installed linuxbrew at first from official page instructions and then i used apt-get.

So I removed the apt-get installation

sudo apt remove linuxbrew-wrapper

and then just added the path to

nano ~/.bashrc

as written in official documentation

echo 'export PATH="$HOME/.linuxbrew/bin:$PATH"' >>~/.bash_profile

then you need to open new terminal for it to take effect.

How to properly install azure-cli in Ubuntu 20.04 using homebrew?

We have ran the below cmdlets in our local environment to install Home brew & azure cli on azure Linux virtual machine which is running with Ubuntu 20.04 image.

Here are the list of Linux cmdlets used:

sudo apt update
sudo apt-get install build-essential
sudo apt install git -y ##installing git
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" ##Run Homebrew installation Script
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" ##Add Homebrew to your path

To ensure everything is working correctly to use brew, we can run its command

  brew doctor

It may give the warning to install GCC and to remove that simply install it using brew

 brew install gcc 

To install azure-cli with last version as per the documentation

brew install azure-cli

Here is the output screenshot for reference:

Sample Image

Sample Image

You can refer this blog to install home brew on Ubuntu20.04 linux machine.



Related Topics



Leave a reply



Submit