Give your Mac the entire handy command line iTerm2 + ZSH + oh-my-zsh + powerlevel10k

introduce

  • Iterm2 is a terminal simulator for MacOS that is essentially not that different from any other terminal. But it has more features and a better user experience than the one that comes with it.
  • The Z shell is a Unix shell. Similar to Bash, KSH, etc. More functionality than the native shell.
  • Oh My Zsh is a community-maintained framework for managing the configuration of Zsh. And it has its own theme, plug-in system, and so on to provide easier customization.
  • PowerLevel10K is a very convenient install force use ZSH theme.
  • BREW is the package manager under macOS. If you are familiar with Linux, Brew is like Apt, Yum, Npm, Pip and so on.

material

  • Any computer that runs Linux, MacOS.
  • If you are using a Mac, you can use BREW to install the following software. If it’s another Linux or something, you can use the corresponding package manager to replace it.

steps

1. Command Line Tools

If you’re on a Mac, you can choose Command Line Tools. It’s a richer command-line tool that adds more of the usual Linux tools.

Installation command:

xcode-select --install

Here you can use the system’s own Terminal to do it, the same as below. After installing iTerm2, you can use iTerm2 for command-line operations.

2. Install BREW (mandatory for Mac)

Again, if you’re on a Mac, you should know this if you have any development experience. It is a package management tool. Easier installation and management of software/tools.

Installation command:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

# or

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

After installing Brew, we install Cask. Brew is a package manager, but most of what we install is command-line software or source code. If we want to install some software with an interface, using Cask is another way to do it, other than to download the source code and build it ourselves. It will help us do everything automatically, we a command to wait on the line is very easy.

Installation command:

brew install cask

3. Install iTerm2

If you have a Brew, cask on it, you can simply load it like this:

brew cask install iterm2

If not, you can go to the website to download it.

4. Install the Zsh

Installation command:

brew install zsh

At this point, Zsh should be installed, and we’ll switch to the default shell.

This command switches the default shell to Zsh.

chsh -s $(which zsh)

If it works, the next time you log into the shell, you’ll be in Zsh. But you can also check to see if it is:

echo $0   # zsh
echo $SHELL

If you want to know which ZSH is currently in use, you can:

which zsh # /usr/local/bin/zsh

Open the first time will automatically pop up the configuration window, according to their own preferences on the configuration line.

5. Install Oh my ZSH

Installation command:

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

# or

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

6. Install the Material theme color (optional)

If you like the Material color scheme, you can set your iTerm2 to the corresponding color.

Installation command:

curl -O https://raw.githubusercontent.com/MartinSeeler/iterm2-material-design/master/material-design-colors.itermcolors

This command will only download the color matching file to the machine, and you will need to configure it yourself.

In iTerm2, click iTerm2 > Preferences on the menu. (Commond +,)

Import the color table following the red box as shown below, and select the theme color in the blue box.

7. Font required to install <s> </s> (optional)

In order to maximize the <s> load effect </s> production efficiency, how can we not have a command line full of ICONS!!

In order to be able to display character ICONS, we need to install Nerd Fonts, which are available for download on the official website.

You can also install through BREW:

brew tap homebrew/cask-fonts
brew install --cask font-hack-nerd-font

You can also download the Font file and install it yourself: Hack Regular Nerd Font Complete

8. Powerlevel10k installation

PowerLevel10K is better than its predecessor, PowerLevel9K 🔥

It provides a variety of different ways to install, see here

We have installed Oh My Zsh in front, so we can directly install it like this:

git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k

There is also an official mirror on Gitee.com:

git clone --depth=1 https://gitee.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k

Open the configuration file and change it to this theme:

# ~/.zshrc

ZSH_THEME="powerlevel10k/powerlevel10k"

Open the first time will automatically pop up the configuration window, according to their own preferences on the configuration line.

If you still have unexplained font problems after installation, it also has a recommended font download: GitHub

If you don’t like to change the configuration, you can also run this at any time to modify the configuration item:

p10k configure

The last

Whether you like flashy displays or simple displays, I would recommend installing these tools, because displays can be configured, but what they provide is either not installed or not. It may take a little getting used to using these tools at first, but once you get the hang of it, you’ll find that they’re really productive and comfortable to use.

Because my own configuration is not the same in different machines, let’s choose one of the styles to show you below