daton's mac
  • Introduction
  • Hackintosh
    • Requirements
    • Prepare USB Drive
    • Install OSX
    • Post installation
    • WiFi and Bluetooth PCI device
    • System Updates
    • Keyboard Mapping
    • Troubleshooting
  • Windows with WSL
    • Setup for Node.js
    • LinuxBrew
    • Powershell
    • WSL bash and zsh
  • Xcode
  • Homebrew
  • iTerm2
    • Plugins
  • Gifox
  • Node.js
    • Webpack
  • VS Code
  • SSH
  • Git
  • GitKraken
  • Docker
    • Remove Docker things
    • Env vars
    • Frequently used commands
  • Docker on Windows
  • MongoDB
  • Postgres
  • Sentry
  • Redis
  • Ghostscript and Imagemagick
  • Codeanywhere
  • Terraform
  • Kubernetes
    • Helm
    • Docker Desktop for Mac
    • Kubernetes on DigitalOcean
    • K8S with Traefik as IC
    • Kubernetes managed by StackPointCloud
    • Use Docker Images from Private Registry
    • Use a minikube locally
  • Web Apps
  • IoT
  • NVIDIA
Powered by GitBook
On this page
  • Installation
  • Customization
  • Requirements
  • Install zsh
  • Oh My Zsh
  • Font Setup
  • We can finally install Spaceship

iTerm2

PreviousHomebrewNextPlugins

Last updated 6 years ago

is an open source replacement for Apple's Terminal. It's highly customizable and comes with a lot of useful features.

Installation

You can get the app from . Once downloaded, drag and drop the iTermapplication file into your Applications folder.

Instead of downloading and installing iTerm2 manually, you can use Homebrew brew cask install iterm2

Customization

We are going to setup

The final setup will be like this:

Requirements

For correct work you will first need:

Install zsh

The Z shell (also known as zsh) is a Unix shell that is built on top of bash (the default shell for macOS) with additional features. It's recommended to use zsh over bash. It's also highly recommended to install a framework with zsh as it makes dealing with configuration, plugins and themes a lot nicer.

We've also included an env.sh file where we store our aliases, exports, path changes etc. We put this in a separate file to not pollute our main configuration file too much. This file is found in the bottom of this page.

Install zsh using Homebrew:

$ brew install zsh

The configuration file for zsh is called .zshrc and lives in your home folder (~/.zshrc).

Oh My Zsh

Install Oh My Zsh:

sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

The installation script should set zsh to your default shell, but if it doesn't you can do it manually:

chsh -s $(which zsh)

Only for Linux:

We can get an error: chsh: /home/linuxbrew/.linuxbrew/bin/zsh is an invalid shell

To fix this error we need to add zsh in the list of the available shells in the system, so run:

command -v zsh | sudo tee -a /etc/shells

Then we can set zsh as default shell with:

sudo chsh -s "$(command -v zsh)" "${USER}"

Configuration

To apply the changes you make you need to either start new shell instance or run:

source ~/.zshrc

Plugins

Add plugins to your shell by adding the name of the plugin to the plugin array in your .zshrc.

plugins=(git colored-man-pages colorize brew osx zsh-syntax-highlighting)

Font Setup

To use spaceshipwe need to setup Powerline Fonts. To do it open a new terminal and exec the following commands:

# clone poweline fonts repo
git clone https://github.com/powerline/fonts.git --depth=1
# install it 
cd fonts/
./install.sh
# clean-up a bit
cd ..
rm -rf fonts/

Setting fonts in iTerm2

In Preferences > Profiles > Text and select the fonts:

Installing a patched font will mess up the integrated terminal in Visual Studio Code unless you use the proper settings. You'll need to go to settings (CMD + ,) and add or edit the following values:

  • for Source Code Pro: "terminal.integrated.fontFamily": "Source Code Pro for Powerline"

  • for Meslo: "terminal.integrated.fontFamily": "Meslo LG M for Powerline"

  • for other fonts you'll need to check the font name in Font Book.

You can also set the font size e.g.: "terminal.integrated.fontSize": 14

We can finally install Spaceship

In the terminal run:

# clone spaceship repo in the themes folder of zsh
git clone https://github.com/denysdovhan/spaceship-prompt.git "$ZSH_CUSTOM/themes/spaceship-prompt"
# link the folder 
ln -s "$ZSH_CUSTOM/themes/spaceship-prompt/spaceship.zsh-theme" "$ZSH_CUSTOM/themes/spaceship.zsh-theme"

Now open ~/.zshrc and replace ZSH_THEME="robbyrussell" with ZSH_THEME="spaceship"

Restart iTerm2 and at this point you should have a result like this:

(v5.0.6 or recent) must be installed.

must be installed and used in your terminal.

Now you should install a framework, we'll use .

is an open source, community-driven framework for managing your zsh configuration. It comes with a bunch of features out of the box and improves your terminal experience.

The out-of-the-box configuration is usable but you probably want to customise it to suit your needs. The contains a lot of useful information if you want to deep dive into what you can do with Oh My Zsh, but we'll cover the basics here.

You'll find a list of all plugins on the . Note that adding plugins can cause your shell startup time to increase.

You can find the official spaceshipt-prompt documentation on Gitbook here:

zsh
Powerline Font
Oh My Zsh
Oh My Zsh
Official Wiki
Oh My Zsh Wiki
https://denysdovhan.com/spaceship-prompt/
iTerm2
iTerm2 downloads page
spaceship-prompt
Image from spaceship-prompt