Why you should give a chance to Fish shell

Probably, a lot of you already heard about Z-shell. It’s particularly popular because of an awesome package Oh My Zsh. Within relatively easy installation you get fully fledged shell ready to work with a bunch of plugins already pre-installed and rest of it easily configurable. At least they say that.

I’ve used Zsh for many years yet I’ve recently tried another approach. During my latest hardware upgrade, I’ve tried to experiment and I’ve installed Fish shell. After one year I have to say that I’m not planning to go back and I’d like to encourage you to try it as well.

With Zsh you can do awesome things (check it out the article of my friend @satya164), there are packages for everything I would say. On the other hand, you have to pay price for that. Firstly you need to configure it, secondly, it could happen that your shell’s startup time will be affected. Fish has chosen the different approach.

Let’s take a look on this recording of my terminal. Just to get an idea what I’m talking about.


Let’s sum it up. You could have seen:

and all of it out of the box! Awesome, right?

How to install? (on 🍎)

  1. install Fish via Brew 🍺
  2. Add Fish to known shells
  3. Set default shell to Fish
brew install fish 
sudo echo /usr/local/bin/fish >> /etc/shells
chsh -s /usr/local/bin/fish

But what to do if you want some MOAR?

I would heavily recommend Fisher plugin manager for Fish shell.

Let’s install it!

curl -Lo ~/.config/fish/functions/fisher.fish — create-dirs https://git.io/fisher

Now you are all set to install all the sweets you think of. Need some inspiration?

  1. Done — plugin to automatically receive notifications when long processes finish.
    fisher add franciscolourenco/done
  2. Carp — my personalized theme :)
    fisher add jukben/carp
  3. ZZ script inside fish shell
    brew install z
    fisher add jukben/z
  4. 4. fzf— useful fzf key bindings in fish
    fisher add jorgebucaran/fzf

So if you are still with me you might ask: “What’s the catch?”

Fish is not 100% POSIX compliant. Fish is how Wikipedia claims considered as “exotic shell”. I love the scripting syntax, it also provides nice error complaints, which is always pretty useful. But what does it mean it in real life, right?

You might be used to use quite often command like this:

ENV=test yarn start

Unfortunately, fish will say

fish: Unsupported use of ‘=’. To run ‘yarn’ with a modified environment, please use ‘env ENV=test yarn…’

so as you have probably assumed correctly, you have to type

env ENV=test yarn start

It’s not so terrible, right?

Another quite popular example is

yarn && yarn run

UPDATE: Fish 3.0 newly supports `&&` and `||`, so feel free to use whenever syntax you like. 🎉

Again, unfortunately, fish will say

fish: Unsupported use of ‘&&’. In fish, please use ‘COMMAND; and COMMAND’.

so once you type

yarn; and yarn run

everything will be OK. I know that it could be a pain, especially from the beginning. But I hope you can make it through. And if cannot there is always the plugin for it™.

Bass — makes it easy to use utilities written for Bash in fish shell

fisher add edc/bass

Don’t worry, all of your other utilities will be fine as soon they have correct Shebang e.g #!/bin/sh. For example, all NPM scripts (npm/yarn run …) are run under sh as well, so you should type your commands as you’re used to.

We made it! I hope you have enjoyed this article. If you like it or you have any question, please feel free to comment it bellow 👇.

P.S: You can check it out my dotfiles for the inspiration. Versioned with gbck tool what I made.

P.P.S: This is repost from Dev.to

Trying to solve engineering problems by talking. During night usually debugging TypeScript.