Give your Mac the entire handy command line iTerm2 + ZSH + oh-my-zsh + PowerLevel10k
introduce
-
ITerm2 is a MacOS terminal emulator that is essentially no different from any other terminal. But it has more features and a better user experience than the built-in terminal.
-
Zsh is The Z shell. It is a Unix shell. Like Bash, KSH, etc. Provides more functionality than the native shell.
-
Oh My ZSH Oh my ZSH is a community maintained framework for managing the configuration of ZSH. And it has its own theme, plug-in system, etc., to provide easier customization.
-
Powerlevel10k is a very easy theme to install using ZSH.
-
Brew is the package manager under MacOS. Because there is no official package manager, so there is such a thing, familiar with Linux students, Brew is similar to Apt, Yum, Npm, Pip such tools.
material
-
Any computer running Linux, MacOS.
-
If you are using a Mac, you can install the following software using Brew. If it is another Linux, for example, you can use the corresponding package manager.
steps
1. (Optional) Install the Command Line Tools.
If you’re on a Mac, you can install the Command Line Tools. It is a richer command line tool, on the basis of the original to add more commonly used Linux tools.
Install command:
xcode-select --install
Copy the code
Here you can use the system’s own Terminal to do that, same as below. After iTerm2 is installed, 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 experience developing classes. It is a package management tool. Easier installation and management of software/tools.
Install 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)"
Copy the code
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 interfaces, Cask is another way to do it, other than just write the source code and build it ourselves. It will do everything for us automatically, and it will be very easy for us to wait at the command.
Install command:
brew install cask
Copy the code
3. Install iTerm2
If you have the above Brew, cask, then you can directly install:
brew cask install iterm2
Copy the code
If you don’t have one, you can download it on its website.
4. Install the Zsh
Install command:
brew install zsh
Copy the code
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)
Copy the code
If the change is successful, the next time you log in to the shell, you will be in Zsh. But you can also check to see if it’s true:
echo $0 # zsh
echo $SHELL
Copy the code
If you want to know which Zsh is currently in use, you can:
which zsh # /usr/local/bin/zsh
Copy the code
Open for the first time will automatically pop up the configuration window, according to their preferences on the configuration line.
5. Install Oh My ZSH
Install 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 -)"
Copy the code
6. Install Material Theme color (optional)
If you like the Material color palette, you can set your iTerm2 to that color.
Install command:
curl -O https://raw.githubusercontent.com/MartinSeeler/iterm2-material-design/master/material-design-colors.itermcolors
Copy the code
This command will only download the color scheme file to your machine; you will need to configure it yourself.
ITerm2 > Preferences. (Commond +,)
Follow the path below to import the color table with the red box, and then select the theme color in the blue box.
7. InstallPack to forceRequired font (optional)
In order to maximize productivity, you can’t have a command line full of ICONS!!
In order to display character ICONS, we need to install Nerd Fonts, which are available for download on our website.
Can also be installed via Brew:
brew tap homebrew/cask-fonts
brew install --cask font-hack-nerd-font
Copy the code
You can also download the Font file and install it: Hack Regular Nerd Font Complete
8. Powerlevel10k installation
Powerlevel10k was good when its predecessor, Powerlevel9k, was 🔥
It provides a number of different ways to install, see here
Oh my ZSH = Oh my ZSH = Oh my ZSH
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
Copy the code
Official mirrors are also available on Gitee.com:
git clone --depth=1 https://gitee.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
Copy the code
Open the configuration file and change it to this theme:
# ~/.zshrc
ZSH_THEME="powerlevel10k/powerlevel10k"
Copy the code
Open for the first time will automatically pop up the configuration window, according to their preferences on the configuration line.
It also has a recommended font download on Github if you still have unexplained font issues after installation
If you do not like the configuration and want to change the configuration, you can also run this at any time to change the configuration item:
p10k configure
Copy the code
The last
Whether you like bells and bells or prefer simple displays, I would recommend installing these tools because displays can be configured, but they offer nothing. There may be a little acclimatisation at first, but once you get the hang of it, you’ll find that these things are really efficient and comfortable to use.
Because I already installed in different machine configuration is not the same, below choose one of the style to give you a look ~