Setting up ZSH on FreeBSD
🕐 2 minutes
What is ZSH
ZSH is the Swiss army knife of shells. It combines the most popular features of all other shells and can be customized to our needs. Users of Bourne and C style shells will feel right at home. ZSH offers smart completion, spell checking and is fully extensible through plug-ins.
We can install ZSH with the following command:
$: doas pkg install zsh
To be able to use ZSH as default shell we have to do the following:
$: chsh -s zsh <username>
What is ohmyzsh
ohmyzsh is an open-source community-driven framework for managing our zsh configuration.
It provides plugins for things like ansible, bazel, git, tmux, etc. It is fully customizable and offers dozens of different themes.
Sounds boring. Let’s try it again.
ohmyzsh won’t make us a 10 times faster developer…. but it will make us feel like one.
Here’s how we can install it:
$: doas pkg install ohmyzsh
If we have an existing ZSH configuration file, we will back up it first with the following command:
$: cp ~/.zshrc ~/.zshrc.orig
Then we create a fresh ZSH configuration file:
$: cp /usr/local/share/ohmyzsh/templates/zshrc.zsh-template ~/.zshrc
You are welcome to take a closer look at the configuration file, it’s pretty well documented, and please have no hesitation to customize it to your liking.
ohmyzsh also comes with many pre-made themes, just have a look here, and you can easily change it in the configuration file.
Furthermore, ohmyzsh can be extended by plug-ins. Currently, there are about 270 plug-ins available. You can see the list here. Just have a look, there are many useful plug-ins available.
My ZSH shell currently looks like this.