Homebrew on Endless

Homebrew was originally made for Mac OS X where it exposes the BSD subsystem for use by the user. It creates a working build environment within the users home folder and in operation is compiles and installs applications from source into a sandboxed application that runs entirely from within the user folder. Very similar to “jails” in BSD.

The Homebrew homepage is here. https://brew.sh/. When I copied the script into the terminal in Endless, I am informed that “curl” is not installed. I assumed that “curl” was a common part of linux installs, I guess not, either that or I do not have it in the path. I any event has anyone else tried Homebrew with Endless. It seems to me that it would be a nice tool to use to compile and use software that is not generally easily available in Endless.

I use brew on macOS but didn’t realized that they added support for Linux some time ago :slight_smile: - thanks for the hint!

And yes, it will work on Endless OS, but it involves a few extra steps. I just installed it using the following procedure:

Install curl

We need curl, so we install a static binary build of it:

sudo mkdir -p /usr/local/bin
sudo wget -O /usr/local/bin/curl https://github.com/moparisthebest/static-curl/releases/latest/download/curl-amd64
sudo chmod +x /usr/local/bin/curl

Install brew

… it’s installed with the same command as given on their homepage, but you have to make sure to press Ctrl-D when asked, as we want a per-user local installation:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

when the installation has finished, you need to put some environment variables into your shells startup script:

echo PATH=${PATH}:~/.linuxbrew/bin >> ~/.bashrc
export HOMEBREW_CURL_PATH=/usr/local/bin/curl >> ~/.bashrc
export MANPATH=${MANPATH}:~/.linuxbrew/share/man >> ~/.bashrc

Use brew

Example, install the tool sponge

brew install sponge
3 Likes

Thank you once again for your excellent lucid directions. I think Homebrew is a nice fit with Endless. I have been wanting a bit more fine grained control and configuration than is available in Gnome-Boxes and Homebrew allow me to install qemu and virtualize-manager while not needing to dig into or change the very stable solid OSTree. Thanks again and have a nice day.

This is a great tutorial @egrath! It would be interesting to compare Brew with Toolbox. The same sponge command can be installed in Endless with toolbox like this:

toolbox enter
sudo dnf install moreutils

IMHO those two technologies are not directly comparable, as they serve different purposes.

Toolbox is based on Podman, which essentially gives you a complete independent container for running applications in a constrained way. In the toolbox scenario, the application in question is a interactive shell.

Brew on the other hand provides the host system with commands not shipped with the host system. They build the applications in a way that they have very little dependencies on the available libraries on the host. It was originally developed for Mac OS X, as it’s essentially a UNIX based system without many of the tools, UNIX users are used to.

IMHO both technologies are best used together for different tasks and requirements. Personally, i use Brew to spice up the host system with various commands i need, but are not available OOB in EOS and Podman to run different development environments for my professional use.

As this may be useful for others going a similar route, there’s a huge drawback in Podman: After a container has been created, it’s configuration can’t be changed (easily). If for example you pass in device nodes during creation and those device nodes change, the container will no longer start. You have to export the container filesystem, recreate the container and import the formerly exported filesystem. A example of this:

    podman run --name ${NAME} \
        --tty \
        --interactive \
        --env DISPLAY \
        --volume /tmp/.X11-unix:/tmp/.X11-unix \
        --volume /etc/localtime:/etc/localtime:ro \
        --volume ${HOME}:/mnt \
        --security-opt seccomp=unconfined \
        --annotation run.oci.keep_original_groups=1 \
        --device /dev/dri/card0 \
        --device /dev/bus/usb \
        ${OPT_PARAMS} \
        ${IMAGE} \
        /bin/bash

In the above case, i pass the entire USB bus into the container during creation. As soon as the USB configuration of the host changes (e.g. move the USB mouse to another port) the container won’t run anymore. The reason for this odd behavior is, that Podman in general isn’t meant to provide long running containers which host a entire operating system for a long period of time. Normally, containers are created on-demand for running a specific application within a specific containerized os version (like a NGINX webserver on a Ubuntu 22.04 instance during startup of the host)

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.