If the output is something like /bin/zsh then read on! Otherwise please make sure that you have zsh installed and set as your default login shell before continuing. Zsh introduces many features, but there’s a popular library called oh-my-zsh which adds even more convenience methods on top of zsh. Installation instructions are on the homepage:
Most of this tutorial will work without oh-my-zsh, but I’ll point out which customizations rely on it. Now that you have your shell, let’s get ready to customize!
Theme installation with oh-my-zsh
One of the most popular features of oh-my-zsh is its built-in theme tooling. If you’re using oh-my-zsh you can keep your themes in the ~/.oh-my-zsh/themes directory as a .zsh-theme file. You’ll see that this directory is prepopulated with over 100 themes already! You can use any of these predefined themes, or follow this guide to create your own. Even if you plan on making your own, these can be a good inspiration or reference for the look you want to achieve. The active theme is defined in your ~/.zshrc file (your general-purpose zsh configuration file) by the variable called ZSH_THEME. The theme file in the theme directory corresponding to this value will be your active theme. For example, you might see ZSH_THEME=robbyrussell in your ~/.zshrc file, which means your terminal will use the theme described in ~/.oh-my-zsh/themes/robbyrussell.zsh-theme. Try changing the ZSH_THEME to theunraveler, then source ~/.zshrc in your terminal and see what happens!
Create and install a custom theme in just 3 easy steps!
Create a .zsh-theme file in that directory and write your theme using the guide below
Set ZSH_THEME=your-theme-name in your ~/.zshrc file
$ source ~/.zshrc in your terminal to refresh your zsh profile
Sometimes you will follow this guide to the letter and your theme will still not seem to update or render as expected… try closing your terminal and opening a fresh terminal window! Sometimes your shell accidentally holds onto outdated variables and turning it off and on again should reset everything fresh ✨ That’s it! In the next section I will provide a quick reference for some basic zsh theme properties you may want to use. If the quick reference lacks context for you at any point, check out the examples provided below it to get you started!
# purple username
# current directory, two levels deep
# current time with milliseconds
# returns 👾 if there are errors, nothing otherwise
# set the git_prompt_info text
# putting it all together
PROMPT='%B$(username) $(directory)$(git_prompt_info)%b '