
Oh My Zsh For Mac
前些天给命令行设置标题遇到一奇葩问题,最终调试发现是 Oh-My-Zsh 的锅。 在启用 Oh-My-Zsh 后,使用命令: echo -e ' 033;this is the title 007' 居然无法修改终端窗口标题?不过,仔细观察还是会注意到标题「闪.
The Z shell (also known as zsh
) is a Unix shell that is built on top of bash
(the default shell for macOS) with additional features. It's recommended to usezsh
over bash
. It's also highly recommended to install a framework withzsh
as it makes dealing with configuration, plugins and themes a lot nicer.
We've also included an env.sh
file where we store our aliases, exports, pathchanges etc. We put this in a separate file to not pollute our mainconfiguration file too much. This file is found in the bottom of this page.
Install zsh
using Homebrew:
Now you should install a framework, we recommend to use Oh My Zshor Prezto. Note that you shouldpick one of them, not use both.
The configuration file for zsh
is called .zshrc
and lives in your homefolder (~/.zshrc
).
Oh My Zsh
Oh My Zsh is an open source,community-driven framework for managing your zsh
configuration. It comeswith a bunch of features out of the box and improves your terminal experience.
Install Oh My Zsh:
The installation script should set zsh
to your default shell, but if itdoesn't you can do it manually:
Configuration
The out-of-the-box configuration is usable but you probably want to customiseit to suit your needs. The office us season 1. The Official Wikicontains a lot of useful information if you want to deep dive into what youcan do with Oh My Zsh, but we'll cover the basics here.
To apply the changes you make you need to either start new shell instanceor run:
Plugins
Add plugins to your shell by adding the name of the plugin to the plugin
array in your .zshrc
.
You'll find a list of all plugins on the Oh My Zsh Wiki.Note that adding plugins can cause your shell startup time to increase.
Themes
Changing theme is as simple as changing a string in your configuration file.The default theme is robbyrussell
. Just change that value to change theme,and don't forget to apply your changes.
You'll find a list of themes with screenshots on theOh My Zsh Wiki.
Prezto
Prezto is a configuration frameworkfor zsh
; it enriches the command line interface environment with sanedefaults, aliases, functions, auto completion, and prompt themes.
Install Prezto:
Next create your ~/.zshrc
by running:
For more information on customisation visit the GitHub repository forPrezto.
Modules
Add modules to Prezto by editing ~/.zpreztorc
and adding the modules asstrings to the list:
And don't forget to apply your changes by starting a new shell instance.
Themes
To list all available themes run:
Then open up your config file (~/.zpreztorc
) and change to the theme you want:

env.sh
To include env.sh
, open ~/.zshrc
and add the following:
This file comes with some pre-defined settings, they are all optional.Please review them before you use them as your configuration. These are justexamples to show you what you can customise in your shell.