Speeding up my Fish login

I’ve been using the Fish shell for over 4 years and absolutely love it. From the built in auto complete that is generated from your man pages to its take on shell history it all just gels so nicely together. If you’ve only ever used bash for your time in the shell I highly recommend giving it a go but beware like anything new it does take some getting used to.

I’m not sure whether it was just timing but after upgrading to Catalina I found that new windows were taking 5+ seconds to launch. Super annoying when you’re trying to debug something and open multiple windows at once.

I finally had enough and found this bug report which was my salvation. I ran the debug command from that thread (fish -d 3) and saw it looping over this:

set local_path $x $local_path' with pgrp -2

Turns out I was adding to my $PATHS in my config.fish file like this:

set -g fish_user_paths ~/bin /usr/local/sbin /usr/local/mysql/bin $fish_user_paths

Which was causing my fish_user_paths variable to get longer and longer with each new shell causing whatever things Fish does on launch (scanning paths for functions maybe?) to loop over the same directories again and again.

Speeding things up

The fix was simple, just remove the config from my environment:

set -e fish_user_paths
Note: fish_user_paths is a string, not your custom paths

And then set it a single time universally:

set -U fish_user_paths ~/bin /usr/local/sbin /usr/local/mysql/bin

After this my shell was back to its normal speedy startup.

Photo by Marquas Dietachmair on Unsplash .