How to set up Homebrew on Linux with Fish Shell ๐Ÿบ+๐Ÿง+๐Ÿ 

How to set up Homebrew on Linux with Fish Shell ๐Ÿบ+๐Ÿง+๐Ÿ 

ยท

2 min read

If you were a developer with a Mac OS X as your primary driver, you would have definitely used Homebrew. It's the most definitive package manager for Mac and just today I learned that they support Linux too.

Given that I recently switched from an Arch-based distro to Fedora, I was trying to recreate most of my setup, I found one of the easiest ways to install a few command-line utilities is to use Homebrew. (I miss AUR already)

Here are the steps I used to install it on my Linux box with Fish shell. This is based mostly on the install steps from the official site with minor modifications.

Install the basic requirements

For Debian/Ubuntu:

sudo apt install -y build-essential procps curl file git

For Fedora:

sudo yum groupinstall 'Development Tools'
sudo yum install procps-ng curl file git
sudo yum install libxcrypt-compat # needed by Fedora 30 and up

Install Brew

The default installation command on the brew homepage would error out if you run in a non-bash shell. You could switch to bash temporarily and run it or instead, run this command from in your fish shell.

sudo curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh | bash

This would install everything you need in /home/linuxbrew/ directory.

Add Homebrew to your PATH

At the end of the install script, there are a few commands that you have to execute. That adds Homebrew commands to your PATH and makes sure you can run the commands. But the command would fail if you run it in the Fish shell.

Instead here are the changes you would have to do to make it run in Fish:

eval (/home/linuxbrew/.linuxbrew/bin/brew shellenv)
echo 'eval (/home/linuxbrew/.linuxbrew/bin/brew shellenv)' >> ~/.config/fish/config.fish

I would suggest you run the bash version also (that adds a line in your .bash_profile file.)

Testing Brew

Now that you have installed brew, let's test it out by installing a simple program.

brew install hello

This installs a hello program that prints "Hello, world!" in the terminal.

Now, this is done, you can go ahead and install all your favourite programs using brew.

ย