Published on

Setup your fancy terminal

Authors
  • avatar
    Name
    Tong
    Twitter

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)

For macOS:

brew install zsh

For Ubuntu:

sudo apt install zsh

Install Oh My Zsh (omz)

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

Set zsh as your default shell

chsh -s $(which zsh)

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

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
)

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.

For macOS:

brew tap homebrew/cask-fonts
brew install --cask font-fira-code-nerd-font

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

⌘,

For Ubuntu:

sudo apt install fonts-firacode

For macOS and Ubuntu:

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

eval "$(starship init zsh)"

Result

Fancy Terminal screenshot
View on GitHubThis article is licensed under a CC BY-SA 4.0 license.