1

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.

| improve this question | | | | |
  • I am sure you have tried this, but as a systems administrator I encourage all our users to definitely ask us first about installing it as a system package - we are often happy to do so (though I can't speak for your administrator), and if we aren't we should be able to give you an explanation for why you shouldn't put it in your home directory either. – Zanchey Mar 20 '19 at 13:27
  • @Zanchey The thing is that unfortunately I use just a simple guest account at the cluster and I didn't know if I should really bother the admin for something like that before trying it myself. Now that I reached a dead end due to a missing curses dependency I probably will though, I find fish a huge quality of life improvement. – Cool Cookie Mar 20 '19 at 21:38
5

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 $HOME/local. The fish executable would be located in $HOME/local/bin (which you may want to add to your $PATH).

This obviously assumes that all the needed tools (git, make, 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 fish using chsh or whatever similar command is available on the system.

| improve this answer | | | | |
  • I prefer the use of .local instead of local – Weijun Zhou Mar 19 '19 at 21:18
  • 1
    @WeijunZhou Whatever floats your boat. I personally use $HOME/local/stow/package-name and then GNU stow. I think pip (Python thing) uses $HOME/.local so I don't really want to put my own stuff in there among the Python things I've installed. – Kusalananda Mar 19 '19 at 21:19
  • If you want it to run at login, you'd need to inject an exec $HOME/local/bin/fish -l in your current startup script, likely .bash_profile, .profile (ksh and sh), or .login (csh and tcsh). – Rich Mar 19 '19 at 21:30
  • @Kusalananda I'm trying to do what you said however I encountered another issue. My cmake version is 2.8.11 and fish requires 3.2, how do I upgrade without sudo? Is it doable? – Cool Cookie Mar 19 '19 at 22:59
  • @CoolCookie Well, you could jump down the rabbit hole and try to download and install cmake from sources as well (this is not the place for a tutorial about how to do that though), or you could bite the bullet and go and talk to the admin of that system. – Kusalananda Mar 19 '19 at 23:06
0

Install software rootlessly is a typical problem, and there are many solutions.
For kernel version<3.X, I only recommend linuxbrew, just brew install fish deal with its dependencies like cmake.
For higher, see awesome-linux-containers

| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.