On this tutorial, we will look at how to install Fish Shell and Oh My Fish on macOS. But first, we will look at how to install and configure Fish Shell on macOS. Fish Shell is a command line shell just like the others namely, bash, tcsh, zsh, csh, bourne shell among many others. This shell was developed in the 90s and can run on macOS and Linux among other Operating Systems. There are so many features associated with Fish Shell and they include;

  • Can suggest commands as you keep typing
  • Tab completion and syntax highlighting with Fish Shell makes it an awesome shell
  • With Fish Shell, you can script, access a simple syntax, consistent and clean
  • Awesome VGA color supported by Fish shell
  • You get to enjoy Man page completions with Fish shell
  • From a web page, those with graphical computer can change colors, view functions, history as well as variables
  • Once Fish is installed, you do not need other configurations to use, you just immediately put it to work

Install Fish Shell and Oh My Fish on macOS

Let’s proceed to look at how to install Fish Shell and Oh My Fish on macOS using the process that is shown in the tutorial that follows below. The guide below starts with the installation of Fish Shell followed by how to install Oh My Fish on macOS, stay tuned to the end of the tutorial and you will see for yourself how it is done;

Step 1. Install Fish Shell on macOS

The first step is to start by installing Fish Shell on your macOS system, to do so, we will use brew, the command below shows how it should be done;

brew install fish  

Below is how the output should look like once Fish Shell has been installed;

╭─annalianie at technixleo in ~ 22-07-27 - 20:04:58
╰─○ brew install fish

Running `brew update --auto-update`...
==> Auto-updated Homebrew!
Updated 2 taps (homebrew/core and homebrew/cask).
==> New Casks
polypad

You have 1 outdated formula installed.
You can upgrade it with brew upgrade
or list it with brew outdated.

==> Downloading https://ghcr.io/v2/homebrew/core/pcre2/manifests/10.40
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/pcre2/blobs/sha256:3d2707e8d5a8
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/fish/manifests/3.5.1
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/fish/blobs/sha256:c3ba6fdea61a8
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Installing dependencies for fish: pcre2
==> Installing fish dependency: pcre2
==> Pouring pcre2--10.40.monterey.bottle.tar.gz
🍺  /usr/local/Cellar/pcre2/10.40: 230 files, 6.4MB
==> Installing fish
==> Pouring fish--3.5.1.monterey.bottle.tar.gz
🍺  /usr/local/Cellar/fish/3.5.1: 1,423 files, 15.3MB
==> Running `brew cleanup fish`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).

Step 2. Start Fish

When you open the terminal and find that the shell that appears is not Fish, and yet you already have Fish installed, just on your terminal, type the following command;

fish

This is how the output will look like, showing that you are now using Fish Shell;

╭─annalianie at technixleo in ~ 22-07-27 - 22:29:00
╰─○ fish
Welcome to fish, the friendly interactive shell
Type help for instructions on how to use fish
⋊> ~                                                                    22:32:20

In the case you no longer want to use Fish shell or rather you are doe with it, proceed to type the following on your command line to exit;

exit

The above command will take you back to the previous Shell like as shown below;

⋊> ~ exit                                                               22:32:20
╭─annalianie at technixleo in ~ 22-07-27 - 22:37:53
╰─○

Step 3. Add Fish Shell to /etc/shells

You need to add Fish among the known shells so that it can be recognized. To do so, you need to add Fish Shell to /etc/shells, the command shown below shows you how to do it on your terminal;

 echo /usr/local/bin/fish | sudo tee -a /etc/shells
OR
sudo bash -c 'echo /usr/local/bin/fish >> /etc/shells'

Step 4. Change Fish Shell to Default

In case you want to change the default Shell to Fish, just proceed to run the following command on your terminal;

chsh -s /usr/local/bin/fish

The output should tell you that the Shell is being changed, check below;

⋊> ~ chsh -s /usr/local/bin/fish                                        22:12:46
Changing shell for annalianie.
Password for annalianie:
⋊> ~

To change back to another shell ensure to type exit first on your terminal then press Enter/Return, then proceed to substitute the /usr/local/bin/fish with /bin/bash, /bin/tcsh or /bin/zsh, check example below for how it is done for a /bin/bash Shell;

chsh -s /bin/bash                                                  

Step 5. Configure Fish Shell rc File

To configure the Fish Shell rc file, we ought to edit it. To do so, we need to have a text editor i.e vim, to install vim if you do not have it on your system, proceed to use the command;

brew install vim

Use vim to edit the configuration file that is ~/.config/fish/config.fish, to do so run the command;

vim ~/.config/fish/config.fish

Once the file is open, you need to add the following lines, for sudo bang bang, use the lines;

function sudo
    if test "$argv" = !!
        eval command sudo $history[1]
    else
        command sudo $argv
    end
end

To browse easily to parent directory, add the lines;

function ..
    cd ..
end

For easy access of dropbox folder, utilize the lines;

function db
	set user $HOME
    cd "$HOME/Dropbox"
end

There are so many lines that can be added to the configuration file for various purposes, the above are just but a few.

Step 6. Uninstall Fish

For a successful uninstallation of Fish, ensure to first exit from the Fish Shell by typing exit on the Fish Shell, once you are on your normal shell that is /bin/bash or /bin/zsh, or you can run the command below to check the shell you are using so as to confirm you have exited from the Fish Shell;

annalianie at technixleo in ~ 22-07-27 - 22:51:52
╰─○ echo $0
-zsh

You can then proceed to uninstall Fish using the commands shown below;

rm -Rf /usr/local/etc/fish /usr/local/share/fish ~/.config/fish
rm /usr/local/share/man/man1/fish*.1
cd /usr/local/bin
rm -f fish fish_indent

Method 2. Install Oh My Fish on macOS

Before you begin the installation of Oh My Fish, below are some requirements that you need to meet;

  • fish shell, version 2.2 or later
  • git version 1.9.5 or later

Step 1. Install Oh My Fish on macOS

Since we are done with the installation of Fish Shell like as shown in step 1, we can then proceed to install Oh My Fish, to do so, run the command shown below;

curl -L https://get.oh-my.fish | fish

The output is represented below;

╭─annalianie at technixleo in ~ 22-07-27 - 22:03:42
╰─○ curl -L https://get.oh-my.fish | fish

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   178  100   178    0     0    133      0  0:00:01  0:00:01 --:--:--   134
100 19035  100 19035    0     0   9096      0  0:00:02  0:00:02 --:--:--     0
Checking for a sane environment...
Installing Oh My Fish to /Users/cheronohval/.local/share/omf...
Using release channel "stable".
Cloning master from https://github.com/oh-my-fish/oh-my-fish.git...
Writing bootstrap to /Users/cheronohval/.config/fish/conf.d/omf.fish...
Setting up Oh My Fish configuration...
Updating https://github.com/oh-my-fish/packages-main master... Done!
Installing package default
✔ default successfully installed.
Installation successful!
Welcome to fish, the friendly interactive shell
Type help for instructions on how to use fish

You can also install Oh My Fish using git, to do so, use the commands shown below;

$ git clone https://github.com/oh-my-fish/oh-my-fish
$ cd oh-my-fish
$ bin/install --offline
# with a tarball
$ curl https://raw.githubusercontent.com/oh-my-fish/oh-my-fish/master/bin/install > install
$ fish install --offline=omf.tar.gz

Another method is to opt to install installer script then proceed to customize the installation using the following commands;

curl -L https://get.oh-my.fish > install
fish install --path=~/.local/share/omf –config=~/.config/omf

omf is a management tool used to install new packages and themes. To check availability of omf on your system, just type omf ten proceed to hit enter/return on the command line, below is a section of the output;

⋊> ~ omf                                                                23:59:13
Oh My Fish! - the fish shell framework

USAGE
    omf [options] [<command>] [arguments]

DESCRIPTION
  Provides options to list, download and remove packages, update the framework,
  create a new package, etc.

Step 2. Update Oh My Fish

Update Oh my Fish using omf as follows;

⋊> ~ omf update                                                         00:00:02
Oh My Fish is up to date.
You are now using Oh My Fish version 7.
Updating https://github.com/oh-my-fish/packages-main master... Done!
default is already up-to-date.

Step 3. Cofigure Themes on Oh My Fish

Set themes using omf command. First lets preview available themes using the command below, these are just but a section of themes;

⋊> ~ omf theme                                                          00:00:17
Installed:
default

Available:
agnoster		gianu			plain
aight			gitstatus		pure
anchor			gnuykeaj		pygmalion
ays			godfather		random
batman			graystatus		randomrussel
beloglazov		harleen			red-snapper
bira			heartsteal		rider
bobthefish		idan			robbyrussell
boxfish			integral		sashimi
budspencer		jacaetevha		scorphish
cbjohnson		johanson		separation

To install a theme, run the command;

omf install <theme>

For instance;

omf install gianu

Once the theme has been installed, you can then proceed to apply it using the command;

omf theme <theme> 

The result should be for example;

omf theme gianu

To remove a theme, run the command;

omf remove <name>

Step 4. Uninstall Oh My Fish

To uninstall Oh My Fish, use the command;

omf destroy

Conclusion

We have just completed an article on how to install Fish Shell and Oh My Fish on macOS. The guide started with an introduction of what Fish Shell is, the background of it, the features associated with it as well as its benefits. After the brief introduction, we proceeded to show you how to install Fish Shell on macOS and some other additional information regarding the same. On the second section of the article indicated method 2, we were able to cover Oh My Fish, how to install it on macOS, and a few configuration of it using the omf tool. Check below for more of our articles on macOS systems;

LEAVE A REPLY

Please enter your comment!
Please enter your name here