Install Oh My Zsh on Mac
Introduction
Oh My Zsh is an open-source framework for managing Zsh configuration. It provides a huge collection of themes and plugins to make your terminal more efficient and beautiful.
Install Zsh
First, check if Zsh is already installed:
zsh --version
If not installed, use Homebrew:
brew install zsh
After installation, switch the default shell to zsh:
chsh -s $(which zsh)
Restart your terminal to apply the changes.
Install Oh My Zsh
Use the official installation script:
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
After installation, you’ll see a nice ASCII art pattern.
Configure Theme
Edit the ~/.zshrc file and find the ZSH_THEME configuration:
ZSH_THEME="robbyrussell"
Recommended themes:
robbyrussell- Default theme, minimalagnoster- Feature-rich, requires Powerline fontsspaceship- Shows Git info and Node version
Recommended Plugins
Git Plugin
Oh My Zsh comes with a git plugin that provides many git command aliases:
plugins=(git)
Common aliases:
gst=git statusga=git addgc=git commitgp=git pushgl=git pull
zsh-autosuggestions Plugin
Auto-suggests commands you’ve typed before:
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
Add to ~/.zshrc:
plugins=(git zsh-autosuggestions)
zsh-syntax-highlighting Plugin
Command syntax highlighting:
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
Summary
Oh My Zsh is a powerful terminal enhancement tool. With proper configuration, it can significantly improve your development efficiency. Choose themes and plugins based on your needs.