DEV Community

Cover image for Setup your fancy terminal
Tong
Tong

Posted on

Setup your fancy terminal

Setup your fancy terminal

Using your shell with Oh My Zsh and Starship on macOS

Some use fish shell as it is an interactive, user-friendly, and modern shell. But it does not have POSIX sh compatibility. Using fish as your default shell could break part of your system. In this post, I will focus on zsh. With powerful plugins. You can have a powerful interactive interface.

Install Z shell (zsh)

brew install zsh
Enter fullscreen mode Exit fullscreen mode

Install Oh My Zsh (omz)

sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
Enter fullscreen mode Exit fullscreen mode

Set zsh as your default shell

chsh -s /usr/local/bin/zsh
Enter fullscreen mode Exit fullscreen mode

Install Oh My Zsh plugins

Clone zsh-autosuggestions, zsh-syntax-highlighting and zsh-completions.

git clone https://github.com/zsh-users/zsh-autosuggestions.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

git clone https://github.com/zsh-users/zsh-completions.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-completions
Enter fullscreen mode Exit fullscreen mode

Add the plugin to the list of plugins for Oh My Zsh to load (inside ~/.zshrc):

plugins=( 
    # other plugins...
    zsh-autosuggestions
    zsh-syntax-highlighting
    zsh-completions
)
Enter fullscreen mode Exit fullscreen mode

Starship.rs (a fast fancy prompt written in Rust)

You need Nerd Font installed and enabled in your terminal.

We will install Fira Code Nerd Font.

brew tap homebrew/cask-fonts
brew install --cask font-fira-code-nerd-font
Enter fullscreen mode Exit fullscreen mode

Open your terminal preferences and enable the font you've just downloaded.

⌘,
Enter fullscreen mode Exit fullscreen mode

Add the following to the end of ~/.zshrc:

eval "$(starship init zsh)"
Enter fullscreen mode Exit fullscreen mode

Result

Terminal screenshot

Top comments (0)