Configuring your shell to get the best out of it can become a tedious task. Some common tasks are:
- configuring your prompt to give you more useful information as the default
- display git information if you corresponding directory (e.g. branch, git status, …)
- display information for use virtual envs (rvm, pyenv, nvm)
- configure useful aliases
- writing sophisticated functions for that purpose
Last I was annoyed to do this stuff ever and ever if I get a new computer or so. After digging a bit I found Oh my zsh (OMZ). The claim on their project homepage say all about it in a single sentence:
Oh My Zsh is a delightful, open source, community-driven framework for managing your Zsh configuration. It comes bundled with thousands of helpful functions, helpers, plugins, themes, and a few things that make you shout…“Oh My ZSH!”
Oh wow that’s sounds good, lets try!
To install this gorgeous framework you simply have to run a single command but I want to go a step back and show you how to install recommended parts first to start directly in a clean way.
To use OMZ you need the
zsh (Z shell) as a minimum. If you don’t have it already you need to install it first with the package manager of your target system.
Mac OS X and
Ubuntu I can confirm that
zsh is already installed. On new
Mac OS X versions it is also the default shell for users. On
bash (Bourne-Again SHell) is the default shell.
As OMZ comes with many themes to change the look of your shell and most of them uses powerline fonts to let the prompt look much more eye candy.
powerline fonts you only need to run the following commands in your shell.
$ git clone https://github.com/powerline/fonts.git $ cd fonts $ ./install.sh Copying fonts... Resetting font cache, this may take a moment...
This will download the
powerline fonts repository and install the fonts locally.
The install script also refresh the font cache on a linux system.
After installing the fonts you can delete the repository directory.
oh my zsh
In the easiest case you have to run one single command to install and setup
onmyzsh on your system.
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
This will download and run the installer. The install script works interactively and will ask you some simple questions.
Info: If your user is not configured to use
zsh as login shell the installer ask to change your login shell. If you want to try OMZ first you can answer the question for changing your shell with
You can later change your login shell with
chsh <path to zsh>.
Warning: The installer creates a
.zshrc file. If you already have your own resource file your find backup at
Congratulations! With the steps we described before you installed OMZ framework on your system and you will use it on the next start of your
But this is not all. Next you should configure OMZ that it meets your needs.
To change the look of your shell you can try some of the many themes which come with the framework.
As there comes a massive ammount of themes with OMZ it can be difficult to find the right theme for you by trying it all. For that purpose you can take a look on the Theme list on the OMZ wiki.
The default theme after installation is
robbyrussell and it can be changed by setting the variable
ZSH_THEME within your
One of the most famous themes is the agnoster which is also mentioned on the projects readme file.
Note: If you use a theme which facilitates powerline fonts you also need to adjust the configuration of some tools beside the
iterm2 on OS X does not take care of the font configuration from your shell resource file you need to configure a font that guarantees that the theme is rendered well.
To do so you have to open
Preferences -> Profiles -> <Your Profile> -> Text. Here you have to tick
Use a different font for non-ASCII text and select a font in the
non-ASCII Font dropdown menu.
You can select a Meslo font (e.g.
Meslo LG S for Powerline).
Also the internal
Terminal.app in Mac OS X needs to be configured to use a Powerline Font for rendiring the new prompt correctly.
Here you have to open the following click path:
Preferences -> Profiles -> <Your Profile>. In that pane you need to click the
Change... button in Font section. In the opening dialog you can select a corresponding font (e.g.
Meslo LG S for Powerline).
Visual Studio Code
To let your theme render correctly in VSCode’s internal terminal you need to add the following line to your
settings.json (Preferences: Open Settings (JSON)):
"terminal.integrated.fontFamily": "Meslo LG S for Powerline"
Plugins are a great way to extend your shell with new functionality, e.g. completion scripts, exported functions or aliases to make the life much easier.
OMZ comes with a bunch of plugins. You should take a look a the list of plugins in the repository.
Each plugin should have a README which describes what you get with the plugin.
To use a plugin you only need to add the plugin name to the variable
plugins in your
plugins=( ansible gh git dotenv )
With this little introduction you should be able to install and configure OMZ on your system.
Have fun with that great piece of software.