Having a powerful and aesthetically pleasing terminal environment can significantly improve your productivity as a developer. In this post, I will walk you through setting up iTerm2, Zsh, Oh My Zsh, Starship Theme, custom fonts, and essential plugins like autosuggestions, syntax highlighting, and git.
Step 1: Install iTerm2
iTerm2 is a feature-rich terminal emulator for macOS.
- Download iTerm2 from iterm2.com.
- Install it by dragging the app to your Applications folder.
- Open iTerm2 and set it as your default terminal:
- Go to
Preferences > Profiles > General
. - Set "Command" to
/bin/zsh
.
- Go to
Step 2: Install Zsh
Zsh is a powerful shell with many features beyond Bash.
- Open Terminal (or iTerm2).
- Install Zsh using Homebrew:
brew install zsh
- Make Zsh your default shell:
chsh -s $(which zsh)
Step 3: Install Oh My Zsh
Oh My Zsh is a framework for managing Zsh configuration.
- Install Oh My Zsh with the following command:
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
Step 4: Install Starship Theme
Starship is a cross-shell prompt written in Rust.
- Install Starship:
brew install starship
- Edit your Zsh configuration file (
~/.zshrc
) to use Starship:
echo 'eval "$(starship init zsh)"' >> ~/.zshrc
- Restart your terminal to see the changes.
Step 5: Install Fonts
For a better terminal experience, you need fonts that support powerline and icons.
- Download fonts from Nerd Fonts.
- Install a font like Fira Code Nerd Font:
- Double-click the downloaded
.ttf
file to install it.
- Double-click the downloaded
- Set the font in iTerm2:
- Go to
Preferences > Profiles > Text
. - Select your installed Nerd Font.
- Go to
Step 6: Install Essential Plugins
You can enhance your productivity with plugins like autosuggestions, syntax highlighting, and git.
Autosuggestions Plugin
- Install the plugin:
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
- Enable the plugin in your
~/.zshrc
file:
plugins=(zsh-autosuggestions)
Syntax Highlighting Plugin
- Install the plugin:
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
- Enable the plugin in your
~/.zshrc
file:
plugins=(zsh-syntax-highlighting)
- Ensure this line comes last in your
.zshrc
file:
source ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
Git Plugin
- Git is included with Oh My Zsh, but you need to enable it:
plugins=(git)
Other Useful Plugins
- zsh-completions: Additional completion definitions for Zsh.
brew install zsh-completions
- zsh-history-substring-search: Search your command history with substrings.
git clone https://github.com/zsh-users/zsh-history-substring-search ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-history-substring-search
Step 7: Apply Changes
- Restart your terminal or reload the Zsh configuration:
source ~/.zshrc
Step 8: Customize Starship
You can customize your Starship prompt by creating a configuration file.
- Create the file
~/.config/starship.toml
:
mkdir -p ~/.config && touch ~/.config/starship.toml
- Add the following to
~/.config/starship.toml
for a minimal look:
[character]
success_symbol = "[✔️](bold green)"
error_symbol = "[✘](bold red)"
Conclusion
With iTerm2, Zsh, Oh My Zsh, Starship, and plugins installed, your terminal is now optimized for productivity and aesthetics. Feel free to explore additional plugins and themes to suit your workflow.
Top comments (0)