DEV Community

Cover image for Setting Up iTerm2, Zsh, Oh My Zsh, Starship Theme, Fonts, and Plugins on macOS
Parsa Roshani
Parsa Roshani

Posted on

Setting Up iTerm2, Zsh, Oh My Zsh, Starship Theme, Fonts, and Plugins on macOS

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.

  1. Download iTerm2 from iterm2.com.
  2. Install it by dragging the app to your Applications folder.
  3. Open iTerm2 and set it as your default terminal:
    • Go to Preferences > Profiles > General.
    • Set "Command" to /bin/zsh.

Step 2: Install Zsh

Zsh is a powerful shell with many features beyond Bash.

  1. Open Terminal (or iTerm2).
  2. Install Zsh using Homebrew:
   brew install zsh
Enter fullscreen mode Exit fullscreen mode
  1. Make Zsh your default shell:
   chsh -s $(which zsh)
Enter fullscreen mode Exit fullscreen mode

Step 3: Install Oh My Zsh

Oh My Zsh is a framework for managing Zsh configuration.

  1. Install Oh My Zsh with the following command:
   sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
Enter fullscreen mode Exit fullscreen mode

Step 4: Install Starship Theme

Starship is a cross-shell prompt written in Rust.

  1. Install Starship:
   brew install starship
Enter fullscreen mode Exit fullscreen mode
  1. Edit your Zsh configuration file (~/.zshrc) to use Starship:
   echo 'eval "$(starship init zsh)"' >> ~/.zshrc
Enter fullscreen mode Exit fullscreen mode
  1. Restart your terminal to see the changes.

Step 5: Install Fonts

For a better terminal experience, you need fonts that support powerline and icons.

  1. Download fonts from Nerd Fonts.
  2. Install a font like Fira Code Nerd Font:
    • Double-click the downloaded .ttf file to install it.
  3. Set the font in iTerm2:
    • Go to Preferences > Profiles > Text.
    • Select your installed Nerd Font.

Step 6: Install Essential Plugins

You can enhance your productivity with plugins like autosuggestions, syntax highlighting, and git.

Autosuggestions Plugin

  1. Install the plugin:
   git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
Enter fullscreen mode Exit fullscreen mode
  1. Enable the plugin in your ~/.zshrc file:
   plugins=(zsh-autosuggestions)
Enter fullscreen mode Exit fullscreen mode

Syntax Highlighting Plugin

  1. Install the plugin:
   git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
Enter fullscreen mode Exit fullscreen mode
  1. Enable the plugin in your ~/.zshrc file:
   plugins=(zsh-syntax-highlighting)
Enter fullscreen mode Exit fullscreen mode
  1. Ensure this line comes last in your .zshrc file:
   source ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
Enter fullscreen mode Exit fullscreen mode

Git Plugin

  1. Git is included with Oh My Zsh, but you need to enable it:
   plugins=(git)
Enter fullscreen mode Exit fullscreen mode

Other Useful Plugins

  • zsh-completions: Additional completion definitions for Zsh.
   brew install zsh-completions
Enter fullscreen mode Exit fullscreen mode
  • 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
Enter fullscreen mode Exit fullscreen mode

Step 7: Apply Changes

  1. Restart your terminal or reload the Zsh configuration:
   source ~/.zshrc
Enter fullscreen mode Exit fullscreen mode

Step 8: Customize Starship

You can customize your Starship prompt by creating a configuration file.

  1. Create the file ~/.config/starship.toml:
   mkdir -p ~/.config && touch ~/.config/starship.toml
Enter fullscreen mode Exit fullscreen mode
  1. Add the following to ~/.config/starship.toml for a minimal look:
   [character]
   success_symbol = "[✔️](bold green)"
   error_symbol = "[✘](bold red)"
Enter fullscreen mode Exit fullscreen mode

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)