DEV Community

Fernando B 🚀
Fernando B 🚀

Posted on • Updated on

Updating fish shell from source code

In this post I'll briefly talk about how to update fish from HEAD from linux (Mac OS is different, check out https://github.com/fish-shell/fish-shell for specific build instructions). This means the latest commit in your default branch.

Why would you want to do this, and not wait for a release? Occasionally a feature you want has been fixed, but not released, and releases are quarterly or bi-yearly, etc. Though sometimes running unreleased code can mean untested bugs, and unknown territory. The steps here also work for most other programs provided they have clear build instructions like fish.

Add an update-fish.sh

Let's create an update-fish.sh, usually I run personal scripts from ~/.local/bin/scripts make sure that path is added to your PATH, or you could just drop the script into ~/.local/bin if you prefer. Where you put the script is up to you, and a personal preference. You don't even need the script in path, if you are used to running scripts from a specific path all the time. If the script is in path, you can run it from anywhere.

This assumes the fish-shell repo is already cloned to ~/git, change cd path accordingly if is different

#!/usr/bin/env bash

cd ~/git/fish-shell
# check for upstream updates
git fetch origin
git merge origin/master

# build fish
sudo rm -r build
mkdir build; cd build
cmake ..
make
sudo make install

Enter fullscreen mode Exit fullscreen mode

Make script executable

sudo chmod +x fish-update.sh
Enter fullscreen mode Exit fullscreen mode

Build and Install

Run the script, and when asked for sudo enter your password. Make sure you have all build tools, and dependencies installed. Also listed in the repo. All and all it takes 2~min to build.

update-fish.sh
Enter fullscreen mode Exit fullscreen mode

Lastly check your updated version

fish --version
Enter fullscreen mode Exit fullscreen mode

Top comments (0)