FreeBSD Logo

Install zsh + ohmyzsh on FreeBSD

by

Before you install zsh + ohmyzsh on FreeBSD you need to install FreeBSD. I have a guide for installing it on a Raspberry Pi and one for installing it on a desktop.

There are a lot of great things about FreeBSD but the default Bourne shell feels a bit dated. A couple of years ago Apple replaced Bash with zsh and it was a fantastic choice. Ohmyzsh improves zsh even more, adding eye candy and additional functionality. Once you start digging into the more advanced features of zsh you can save yourself quite a bit of time. At the very least you can make your terminal look pretty damned cool. Looking cool is always important.

Install zsh + ohmyzsh on FreeBSD

Neofetch showing off results.
zsh + ohmyzsh on my FreeBSD Desktop

1. Install zsh

# pkg install zsh

Now make zsh your default shell:

# chsh -s /usr/local/bin/zsh root

Note: change root to whatever user you want to use zsh.

2. Install ohmyzsh

Now we just have to install ohmyzsh. There are instructions on their website but I recommend you use the FreeBSD package:

# pkg install ohmyzsh

Now copy the configuration file to your profile folder:

# cp /usr/local/share/ohmyzsh/templates/zshrc.zsh-template ~/.zshrc

Note that the tilde (~) before the folder means starting in the home folder of the current user. This means that if you’re still logged on as root you’ll have to specify the home folder you want (/usr/home/username). You can do this for each user you want to use ohmyzsh.

3. Configure

Many of the ohmyzsh themes require the Powerline font. You can install it using pkg:

pkg install powerline-fonts

Now open the newly created .zshrc file in your favorite text editor. Look for this line:

ZSH_THEME="robbyrussell"

Browse the zsh themes and install whichever one you prefer. Just replace robbyrussell with the name of your new theme. I’m currently using “agnoster” and “pygmalion.” It’s really just a matter of preference (I like everything on a single line), so experiment until you find one that works best for you.You now know how to install zsh + ohmyzsh on FreeBSD. Enjoy!

F

Back to Top