Fish on macOS - A week long experiment
Dec 16, 2024 - ⏱️ 2 minutes to read
For the next week, I intend to experiment with utilizing Fish as my primary shell on macOS. This challenge was initiated this morning by Francesco, who encouraged me to explore Fish as an alternative shell.
Switching to Fish for a week?
Installation
I followed these steps to install Fish:
- I used Homebrew to install fish.
- I then added fish to the list of available shells.
- Then I switched my default shell.
Something cool
A positive aspect of Fish is the use of the conf.d directory, which helps organize configuration files into individual scripts, making it easier to manage and update customizations without cluttering a single configuration file.
One thing I’ve noticed is that Fish feels noticeably faster than my previous setup with Zsh + Oh My Zsh. It seems more responsive, and the startup time feels snappier.
A first challenge
The default keybinding to edit a command using $EDITOR is Meta+E (contrary to other shells ⌃+X ⌃+E). Since I use the ⌥ (Option) key as a compose key for typing special characters, I cannot remap it to the Meta key. I had to configure a custom bind to bring back ⌃+X ⌃+E functionality.
Dotfiles
If you want to take a look at my configurations or follow along with the changes I make throughout this experiment, you can check out my dotfiles here.
Throughout the week, I will continue experimenting with Fish and refining my setup. Expect further updates!
Day 2
Fish is not POSIX-compliant, but that’s intentional. It’s designed as a user-friendly interactive shell, not as a scripting shell.
Scripts and Compatibility
Many scripts use the following shebangs:
or
or (even better)
Indeed, these scripts presume POSIX compliance, which Fish does not natively support. However, they also specify the interpreter to be used for executing those scripts. As noted in the Gentoo Wiki:
fish should not be set as the system shell by making it the target of the /bin/sh symlink; this could result in an inoperable system.
Key Point: Utilize Fish interactively, while maintaining Bash or a POSIX-compliant shell as the system’s default shell.
Counterpoint
The system()
function executes the provided command (in this instance, echo $SHELL
) within a new shell, your default interactive shell (in my case,
fish
). But you shouldn’t really
use system()
...