Product Designer Setup
  • Introduction
  • Preparation
    • Preparing Your Mac
    • Installing macOS
  • Setup
    • Xcode
    • System Preferences
      • Finder
    • Homebrew
      • Cask
    • Terminal Setups
      • Warp Setup
      • Hyper Setup
      • iTerm2 Setup
        • Zsh
    • Terminal Packages
    • Git
      • Git Ignore
    • Code Editor Setups
      • Visual Studio Code
        • Extensions
        • Preferences
      • Sublime Text
        • Preferences
        • Packages
    • Tech Stack
      • Package Managers
  • Apps + Tools
    • Intro
    • Productivity Tools
    • Design Tools
    • Developer Tools
Powered by GitBook
On this page
  • Shell
  • Oh My Zsh
  • Plugins
  • How do I edit/access the .zshrc file?
  • How to add plugins?
  • Homebrew Stuff To Do
  • iTerm Color Schemes
  • Oh My Zsh Themes
  • Powerline
  • Shortcuts
  • Frequently Asked Questions

Was this helpful?

  1. Setup
  2. Terminal Setups
  3. iTerm2 Setup

Zsh

PreviousiTerm2 SetupNextTerminal Packages

Last updated 1 year ago

Was this helpful?

Announced in June and released in October 2019, has adopted Zsh as the default shell, replacing . Although the copy of zsh available on macOS by default is that one that shipped with the system, it will eventually get out of date. So the first thing to do is to install the latest version, with Homebrew.

So that means - no need to manually install Zsh anymore! 🥳

Install zsh and zsh-completions using Homebrew:

brew install zsh zsh-completions

Upon completing installation, you'll come across this message:

What we'll need to do is to add fpath=(path/to/zsh-completions/src $fpath) to our .zshrc file. However, it will still get overwritten when we install Oh-My-Zsh (Which I'll explain later, so let's go back to this in the next step)

Now let's use a framework built on top of this shell called Oh My Zsh!

Shell

Oh My Zsh

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

Resolving the issue from the previous step

Let's open .zshrc file using Sublime Text

subl ~/.zshrc

Then copy paste this text, and save the file:

fpath=(path/to/zsh-completions/src $fpath)

And go back to the terminal and run this:

rm -f ~/.zcompdump; compinit

Plugins

You can further extend zsh's power and functionalities by adding plugins to Oh My Zsh. There are useful plugins like completion plugins that will let zsh know which arguments the package has so it can autocomplete. We can do so by adding this to our .zshrc file

What is a .zshrc file? Basically, it's a Z-shell resource that contains all your configurations.

How do I edit/access the .zshrc file?

Your .zshrc file is usually located at the root. To open, use your default text editor:

open ~/.zshrc

How to add plugins?

To add a plugin we need to search and add these strings of text to our current plugins list in the .zshrc file. Example:

plugins=(
  git osx extract python ruby rails node npm
)

Homebrew Stuff To Do

One thing we need to do is tell the system to use programs installed by Homebrew (in /usr/local/bin) rather than the OS default if it exists. We do this by adding/usr/local/binto your$PATHenvironment variable.

Now that we've already installed Oh My Zsh! This command will append the text PATH="/usr/local/bin:$PATH" on the .zshrc file

echo export PATH="/usr/local/bin:$PATH" >> ~/.zshrc

iTerm Color Schemes

Open iTerm, go to Preferences > Profiles and create your own color scheme!

  1. Go to Preferences > Profiles and click on the "+" button to add a new profile.

  2. Give it a name, and click on the Colors tab

  3. Import cobalt2.itermcolors by clicking on the Color Presets.. > Import..

  4. After importing, select Color Presets.. > cobalt2

Oh My Zsh Themes

  1. Open & edit your .zshrc file with $ open .zshrc then search & modify the following line $ ZSH_THEME="cobalt2"

Powerline

Powerline uses Pip (Which is a package manager for Python) Unfortunately,

  • Install Powerline

pip3 install --user powerline-status
git clone https://github.com/powerline/fonts
cd fonts
./install.sh

Now head back to iTerm and go to Preferences > Profiles > Text and change the font family to Inconsolata for Powerline, font weight to Medium, and set the font size to 12px. Then you should be seeing icons in your command prompt like this:

You can play around with the size, change the powerline font - up to you guys 😄

Then refresh zsh by typing source ~/.zshrc or by restarting your terminal

Shortcuts

ctrl + a to move at the beginning of the line

ctrl + e to move at the end of the line

ctrl + u to clear the current line

ctrl + k to clear all the characters that precedes the cursor position

ctrl + l to clear the screen

Frequently Asked Questions

It's not working! Did you carefully follow the instructions? Also try restarting your terminal for it to take effect.

rm -f ~/.zcompdump*; compinit 

Install on top of zsh to get additional functionality and supercharge your terminal!

You can also manually select things you want to add from .

My personal favorite is the . To use it:

Download

While there are you can use with Oh My Zsh, my favorite is the . You can click on the theme link and follow the instructions there or follow through here:

Copy & paste the file to ~/.oh-my-zsh/themes/ directory

What is ? It's a statusline plugin for vim, and provides statuslines and prompts. And along with it are that is responsible for the icons you have on your terminal. To enable powerline fonts on the theme we're using:

Clone the and run install.sh to install all powerline fonts

There's these weird [?] symbols on my terminal. Probably missing the

Where are my zsh settings stored? .zshrcfile located in your home directory. It’s a hidden file, so you might not see it in your home directory, but you can view it by running open ~/.zshrcfrom the terminal. Swap out openwith your favorite editor command, such as nano, sublor vim. (these are text editors, nano for , subl for , and vim for )

I have no idea how to use the terminal / So hard to follow the instructions! I suggest taking by Wesbos. When I open my terminal this message shows up:compdef: unknown command or service: rails Just run this and it should be working fine:

Oh My Zsh
this plugins list
Cobalt2 iTerm theme
cobalt2.itermcolors
a lot of themes
Cobalt2 theme
cobalt2.zsh-theme
Powerline
Powerline Fonts
Powerline fonts
powerline fonts
GNU Nano
Sublime Text
Vim
this great course
macOS Catalina
Bash