sudo yum -y install dnf
Are you desperate for the freshest fish? Well, you’ve come to the right place.
The instructions herein describe how to install a much newer version of the fish shell, version 3.1.2, from source on CentOS 7. Further instructions for building fish are available from the fish documentation. For this tutorial to make a lick of sense, you should be familiar with the command-line, Linux, installing packages, and building projects from source.
If you aren’t using the DNF package manager yet, grab that.
sudo yum -y install dnf
Add the EPEL repository for retrieving necessary dependencies.
sudo dnf -y install \
https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
Install the build dependencies.
sudo dnf -y install cmake3 gettext-devel git ncurses-devel ninja-build \
pcre2-devel
Pull down the fish repository.
git clone https://github.com/fish-shell/fish-shell.git
Checkout the latest release tag.
git -C fish-shell switch --detach (git -C fish-shell describe --abbrev=0 --tags)
HEAD is now at 0314b0f1d Release 3.1.2
Configure CMake in the directory fish-shell/build
.
cmake3 -GNinja -B fish-shell/build -S fish-shell
Build fish.
cmake3 --build fish-shell/build
Install fish.
sudo cmake3 --install fish-shell/build
-- Install configuration: "RelWithDebInfo"
Register the shell in /etc/shells
.
echo /usr/local/bin/fish | sudo tee -a /etc/shells
/usr/local/bin/fish
Change your login shell to fish.
chsh -s /usr/local/bin/fish
Changing shell for jordan.
Password:
Shell changed.
Log out and back in to complete the switch to fish.
Because it is CentOS, add /usr/local/bin
to your PATH
.
fish_add_path -p /usr/local/bin
set -pU fish_user_paths /usr/local/bin
To update to the latest version of fish, just checkout the latest version release, build, and install. For completeness, the instructions to update fish are provided below.
Checkout the latest release tag.
git -C fish-shell switch --detach (git -C fish-shell describe --abbrev=0 --tags)
HEAD is now at 0314b0f1d Release 3.1.2
Configure CMake in the directory fish-shell/build
.
cmake3 -GNinja -B fish-shell/build -S fish-shell
Build fish.
cmake3 --build fish-shell/build
Install fish.
sudo cmake3 --install fish-shell/build
-- Install configuration: "RelWithDebInfo"
Packages on CentOS 7 might assume you are using a Bash-compatible login shell.
For instance, the Qt 5 development packages work fine when using a Bash shell.
After switching to fish, building a Qt 5 application failed because it could not find the xcb
plugin.
Setting the QT_QPA_PLATFORM_PLUGIN_PATH
to as shown below resolved this issue.
set -Ux QT_QPA_PLATFORM_PLUGIN_PATH /usr/lib64/qt5/plugins/platforms
The moral of the story is to check any Bash-specific initialization in places such as the /etc/profile
file and the /etc/profile.d
directory.
Otherwise, it’s entirely possible to use Bash as she login shell and and just execute fish from your ~/.bashrc
initialization file.
There’s also a fish plugin called Bass which can handle sourcing Bash files such as /etc/profile
directly.
Refer to the fish page’s section Alternative to fish as the login shell on the Gentoo Wiki for the exact implementation details for these workarounds.
You should notice enhanced cognitive performance from the incredible omega-3 fatty acid profile that only the freshest fish has to offer!