“This article has participated in the good article call order activity, click to see: back end, big front end double track submission, 20,000 yuan prize pool for you to challenge!”
preface
- Won’t you? Is there anyone on a MAC who doesn’t have Homebrew installed?
- Can’t use iTerm2, still dare to call yourself an old driver?
- If you can beat Linux, you can beat MacOS. As a Linux user for many years, when I first started MBP, IT was difficult for me to open the terminal, so I started to play with it, which is also a small experience.
- So, would you like to share a wave on how to build a comfortable looking terminal on MacOS?
introduce
First, the following aspects will be introduced:
- Install Homebrew
- Install iterm2
- Oh – my – ZSH installation
- Configure the topic
- Installing a plug-in
Through the combination of the above, you can perfectly arm your terminal to the teeth!
Install Homebrew
- Homebrew is a software package management tool for the MacOS platform. It has many useful functions for installing, uninstalling, updating, viewing, searching, and more. With a single directive, you can manage packages without having to worry about dependencies and file paths. Terminal artifact, I told you!
Since I have Homebrew installed, uninstall it first:
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/HomebrewUninstall.sh)"
Copy the code
1 install Homebrew
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
Copy the code
If the following interface is displayed, the installation is successful:
Activate environment variables:
source /Users/lpc/.zprofile
Copy the code
Verify the successful installation:
- Install the cask
brew upgrade
brew install cask
brew install git
Copy the code
At this point, Homebrew has been successfully installed.
Install iterm2
- I’ve been looking for shell tools on macOS, including FinalShell, JetBrains, etc. However, the experience was not very comfortable until I met iTerm2; Without a doubt, iTerm2 is the weapon I want.
Install Iterm2 directly using Homebrew:
brew search iterm2
brew install iterm2
Copy the code
Since I already installed Iterm2, it shows installed.
Next, you can turn on iterm2.
Install oH-my-zsh
- Why install OH-my-zsh? It’s simple: smarter autocompletion, command option prompts, richer topics. Let your terminal not single ordinary!
Install ZSH directly using Homebrew:
Set ZSH to the default shell.
- View the current shell usage
echo $SHELL
Copy the code
- If it is not /bin/zsh, set it to /bin/zsh:
chsh -s /bin/zsh
Copy the code
The following is displayed: ZSH has been successfully set:
3 Download OH my ZSH
- Install Wget or Git:
brew install wget
brew install git
Copy the code
- Download oh my ZSH installation package:
wget https://gitee.com/mirrors/oh-my-zsh/raw/master/tools/install.sh
Copy the code
or
git clone https://gitee.com/mirrors/oh-my-zsh.git
Copy the code
Install OH my ZSH:
sh install.sh
Copy the code
Since I have already installed it, I will not uninstall the demo. After the installation, your terminal should have changed.
Configure topics
Configure user environment variables
cat <<EOF>>~/.zshrc
export ZSH="/Users/lpc/.oh-my-zsh"
DEFAULT_USER="$USER"
ZSH_THEME="bira"
source $ZSH/oh-my-zsh.sh
EOF
Copy the code
The theme is BIRa, which is the theme that I used in the demo. To change the theme, change the BIRA in ZSH_THEME=” BIRA “.
More topics can be found at github.com/ohmyzsh/ohm…
5. Install plug-ins
Here are some recommended widgets:
- Thefuck: Fix the wrong command
- ZSH -autosuggestions: Prompts for command input
- Zsh-syntax -highlighting: Right command line highlighting
- Autojump: Folder jump
All of the above plug-ins can be installed using BREW:
brew install thefuck
brew install zsh-autosuggestions
brew install zsh-syntax-highlighting
brew install autojump
Copy the code
After the installation, you need to configure the user environment variables. My environment variables are as follows for reference:
export ZSH="/Users/lpc/.oh-my-zsh"
DEFAULT_USER="$USER"
ZSH_THEME="bira"
plugins=(
git
pip
zsh-autosuggestions
zsh-syntax-highlighting
autojump
)
source $ZSH/oh-my-zsh.sh
export HOMEBREW_NO_AUTO_UPDATE=true
export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles
source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
export ZSH_HIGHLIGHT_HIGHLIGHTERS_DIR=/usr/local/share/zsh-syntax-highlighting/highlighters
eval $(thefuck --alias)
Copy the code
Here’s a simple demonstration of how theFuck is used:
- Brew brew brew brew brew brew brew brew
brew sear google
Copy the code
- Directly to knock
fuck
, ha ha, will automatically identify the correct command:
fuck
Copy the code
- Press Enter to execute:
It’s kind of a rough and cool little plugin.
Write in the last
Setting the background image for the terminal is simple:
Choose iTerm2 – > Preferences – > Profiles – > Windows:
Click on the picture box to select the picture, such as I change a beautiful woman:
It’s all a matter of personal preference, but as for fonts, I think the macOS fonts that come with it are pretty good.
That’s the end of this sharing
If you think the article is helpful to you, like, collect, follow, comment, one key four support, your support is the biggest motivation for my creation.