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.
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.
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:
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!