DEV Community

Nivethan
Nivethan

Posted on

Teach a man to build fish, and he will have fish for a lifetime

I have mixed feelings about fish, I don't like that it's incompatible with bash and I have to shift to bash relatively often just to get everything installing properly but I love the history and command completion in fish. It's in a realm of it's own. I use RHEL 7 for work and so I usually end up having to build fish from source so I can get the newest version. These are those steps so I don't have to constantly google it :)

I installed devtoolset-10 as I figured having a more modern compiler would probably also be required to build fish.

You can find those instructions at:

https://nivethan.dev/devlog/using-a-newer-gcc-in-rhel-7.html

Once you have a more up to date toolchain you'll need to install a newer version of cmake, cmake3. RHEL comes with cmake set to 2.8.

# yum install cmake3
Enter fullscreen mode Exit fullscreen mode

Then we can get fish.

wget https://github.com/fish-shell/fish-shell/releases/download/3.4.0/fish-3.4.0.tar.xz
Enter fullscreen mode Exit fullscreen mode

Now to build it.

> cd fish
> cmake3 .
> make
> sudo make install
Enter fullscreen mode Exit fullscreen mode

Now we need to check where fish was installed.

> which fish
/usr/local/bin/fish
Enter fullscreen mode Exit fullscreen mode

Now update /etc/shells to let it know about fish.

> sudo vim /etc/shells
Enter fullscreen mode Exit fullscreen mode

We need to add /usr/local/bin/fish to /etc/shells if it's not already there.

Finally, we can run chsh and make fish our new default shell!

> chsh
Changing shell for nivethan.
New shell [/usr/bin/bash]: /usr/local/bin/fish
Enter fullscreen mode Exit fullscreen mode

With that we are done! We should now have the latest and greatest shell ready to be used :)

Top comments (0)