HomeAboutRelease Notes

Redefine Your Development Experience with Terminal on MacOS

February 18, 2023

Hey peeps, long time no see! It’s been one year since my last post. I was too lazy to post on my blog while being busy with my works. Today I would like to share about how I configured my terminal to be a really productive tool. Majority of the contents are actually summarized by one of my colleague at ByteDance, 任江都 (Ren Jiangdu), who wrote a brilliant terminal configuration guide inside the organization. I followed the instructions in his guide and eventually configured my terminal to be a powerful weapon. :p. Shout out to Jiangdu! I combined some of my practices with Jiangdu’s suggestions and then I present you this guide.

Terminal App: iTerm2

iTerm2 can be simply downloaded at https://iterm2.com/

Usually I like to have my background of iTerm2 set to be slightly transparent, so that I can see my background image on my desktop. Set the background transparency at Preferences -> Profile -> Window -> Window Appearance. I set my transparency percentage to be 25%.

I use Unsplash Wallpapers to change the background images on daily basis, which always brings me fresh look every day.

Shell: zsh

Check whether you are using zsh as your shell

cat /etc/shells

Set zsh as your default shell

chsh -s /bin/zsh

Install oh-my-zsh

Do you want your terminal to have a better looking? Try oh-my-zsh.

Run the command to install oh-my-zsh

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

See more: https://ohmyz.sh/

Use Roboto Mono font

Roboto Mono font is open sourced by Google, it is an elegant font type and helps much in differentiating 0 and O, l and I.

First, download the font files from RobotoMono/fonts/variable at main · googlefonts/RobotoMono and then install them on your MacOS.

Then in your iTerm to, go to Preferences -> Profiles -> Text -> Font to apply it

Spaceship Prompt theme

Spaceship prompt is a powerful theme to provide users useful information such as user name, current working directory, host name and etc.

To install it, just run

git clone https://github.com/spaceship-prompt/spaceship-prompt.git $ZSH_CUSTOM/themes/spaceship-prompt --depth=1

And in your ~/.zshrc, add change ZSH_THEME as following.

ZSH_THEME="spaceship-prompt/spaceship"

And then run this command to refresh your shell with new configuration.

source ~/.zshrc

Command Highlighting Plugin

Run this command to install the plugin

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

And in your ~/.zshrc, enable the plugin on plugin section.

plugins=(git zsh-syntax-highlighting)

Auto Suggestion Plugin

Run this command to install the plugin

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

And in your ~/.zshrc, enable the plugin on plugin section.

plugins=(git zsh-syntax-highlighting zsh-autosuggestions)

Friendlier Vim

Create a .vimrc file under your ~ directory by

touch ~/.vimrc

And then enter in the following contents

# Syntax highlighting syntax on # Show line number set number # Set 1 tab = 4 spaces set tabstop=4 # Turn on auto indentation set autoindent # Turn on smart indentation set smartindent # Turn on content paste set paste

vim.png

Done~

Thats all for today! I hope you enjoy~


Written by Yi Zhiyue
A Software Engineer · 山不在高,有仙则灵
LinkedIn · GitHub · Email