I want to install the fish shell in a remote server I have no sudo privileges at, so that I can use it whenever I ssh.
You would install it in your home directory.
To do that, you would check out the source repository of the
fish shell from GitHub, and then follow the installation instructions under the section "Building" in the
README.md file, while telling CMake that you'd like to use an alternative installation directory:
git clone --depth=1 https://github.com/fish-shell/fish-shell cd fish-shell mkdir build cd build cmake -DCMAKE_INSTALL_PREFIX=$HOME/local .. make make install
This would install
fish and its associated files under
fish executable would be located in
$HOME/local/bin (which you may want to add to your
This obviously assumes that all the needed tools (
cmake etc.) are available and that the build system finds all needed dependencies1.
To check out a particular release tag, for example
3.0.2 (the most recent release at the time of writing), use
git clone --branch=3.0.2 --depth=1 ... when cloning the repository. If you don't specify a release tag, you will get the latest unstable development version of the code.
You then would have to make your ordinary shell start
fish whenever it starts an interactive shell (assuming you don't want to start
fish manually). If your shell is
bash, you could do that by adding
if [ -x "$HOME/local/bin/fish" ]; then exec "$HOME/local/bin/fish" fi
or something similar to
$HOME/.bashrc. This particular way of doing it would replace the
bash process with a
fish process every time an interactive
bash shell was started.
1On some non-Linux systems, you would also have to manually patch
src/fallback.cpp so that the
locale.h header is included. Otherwise, that file may fail to compile due to
uselocale() not being declared. This is a confirm bug in the code, which will be fixed in release 3.1.0 thanks to this question.
The other option is, as always, to talk to the administrator of the system and get them to install it from a pre-compiled package. You would then be able to change your login shell to
chsh or whatever similar command is available on the system.