1. Background requirements

When you first get a New Mac to work on, many common Linux commands are not installed, such as wget, git, Telnet… These commands are often used in the work, familiar with Linux friends know that there is a powerful yum command, directly take a use, hey hey found error, after the pit found that the original Mac inside this command called BREW, also can have the following SAO operation;

Brew install git brew install Telnet brew install wgetCopy the code

However, when YOU find brew itself needs to be installed, a lot of people online tell you that you can install it directly by using the following instructions;

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

A try on your own, found an error curl: (7) Failed to connect to port 443 raw.githubusercontent.com: Connection refused, as shown in figure 1.1;

The reason is thatraw.githubusercontent.comIt is the old United States, there is no jailbreak basic is not connected, happen to be connected also very slow, specific how to install? Refer to chapter2. Install the brew;

2. Install the brew

2.1 Download and install domestic base stations

Brew full name Homebrew, is a MacOS platform under the software package management tool, with installation, uninstall, update, view, search and many other practical functions. Package management can be implemented with a simple command, and you don’t have to worry about dependencies and file paths. It is very convenient and quick. Terminal essential artifact, Jesus is here I say the same thing! The first chapter said that the direct official website can not download, there is no network Lei Feng to help solve? Yes, someone moved it back to a domestic base station and installed it using the following instructions;

/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
Copy the code

The installation process will let you choose the base station to download the image, usually choose1Just a couple of optionsY/NFill in the blanks as promptedYThe installation is complete until Figure 2.1 appears.

2.2 Activating environment Variables

Activate the environment variable according to the red line in Figure 2.1, that is, run the following statement; Note that Rowyet is a blogger’s account. It varies from person to person, so do not copy it. Note that Rowyet is a blogger’s account. It varies from person to person, so do not copy it. Note that Rowyet is a blogger’s account. It varies from person to person, so do not copy it. Three times, try my best;

source /Users/rowyet/.zprofile
Copy the code

2.3 Test brew

Use the following instructions to do a test. If no error is reported, brew is installed in principle.

#Update the brew
brew upgrade   

#Install the cask
brew install cask

#Install wget
brew install wget

#Install git
brew install git

#Install the Telnet
brew install telnet
Copy the code

3. Install iTerm2

ITerm2 is the best terminal for MacOS, I’m telling you. ITerm2 is the best terminal for MacOS.

  • Liverpoolfc.tv: iterm2.com/
  • Official website download: can also be directly downloaded from the official website, download down a tarball, decompression can be used, but this we havebrewInstead of downloading from the official website, use brew command to download.

Download and install iTerm2 directly from BREW;

brew install iterm2
Copy the code

After the installation is complete, find the diagram in Figure 3.2 on the boot pad.

4. Oh – my – ZSH installation

whyoh-my-zsh? It’s simple: smartershellAutocomplete, command option prompts, richer themes. Let your terminal is not single pick ordinary, a look is installed force god, after the configuration as shown in Figure 4.1.

The installation and configuration steps are as follows.

#Check if ZSH is used for iterm2echo $SHELLIs returned to /bin/zshEcho $SHELL /bin/zsh # return value
#If not, execute the following command
chsh -s /bin/zsh

#To performecho $SHELLvalidation

#If yes, run cat /etc/shells to check that /bin/zsh is valid in the system1 ↵ cat/etc/shells# List of acceptable shells for chpass(1).
# Ftpd will not allow users to connect who are not using
# one of these shells.

#The return value
/bin/bash
/bin/csh
/bin/dash
/bin/ksh
/bin/sh
/bin/tcsh
/bin/zsh

#Download and install Git and wget
brew install wget
brew install git

#Find an empty folder
cd /Applications/tools/
mkdir zsh
cd zsh

#Download oh My ZSH installation package with wget:
wget https://gitee.com/mirrors/oh-my-zsh/raw/master/tools/install.sh

#Or use Git to download the oh My ZSH installation package
git clone https://gitee.com/mirrors/oh-my-zsh.git

#The downloaded file is install.sh
chmod 755 install.sh

#The installation
sh install.sh

Copy the code

After the installation is completed, see Figure 4.2.

5. Configure environment variables

Enter the following instructions to modify the 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

If you want to change the theme, you can directly change the bira in ZSH_THEME=”bira” in the ~/. ZSHRC file. For more topics: github.com/ohmyzsh/ohm… , refresh environment variables after the configuration is complete.

#Refreshing environment variables
source ~/.zshrc
Copy the code

The change in FIG. 5.1 can be obtained;

6. Install the plug-in

Install some interesting plug-ins, as follows

#Start by installing a necessary toolbox
xcode-select --install

#Fixed bugs, classic encountered bugs fuck down
brew install thefuck

#Command Input prompt
brew install zsh-autosuggestions

#Command line highlights
brew install zsh-syntax-highlighting

#Folder jump
brew install autojump

Copy the code

After the installation, you need to configure the environment variable vim ~/.zshrc.

... Omit...#Scroll down to the bottom and modify the following, noting that rowyet is the account of the blogger, do not copy
#Scroll down to the bottom and modify the following, noting that rowyet is the account of the blogger, do not copy
#Scroll down to the bottom and modify the following, noting that rowyet is the account of the blogger, do not copy

export ZSH="/Users/rowyet/.oh-my-zsh"
DEFAULT_USER="rowyet"
ZSH_THEME="bira"
plugins=(
  git
  pip
  zsh-autosuggestions
  zsh-syntax-highlighting
  autojump
)

source /Users/rowyet/.oh-my-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)

#The final wq! Save the exit

Copy the code

Source. ZSHRC refreshes environment variables.

source .zshrc
[oh-my-zsh] plugin 'zsh-autosuggestions' not found
[oh-my-zsh] plugin 'zsh-syntax-highlighting' not found

#Repair the plugin'zsh-autosuggestions' not found
git clone https://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions

#Repair the plugin'zsh-syntax-highlighting' not found
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting
Copy the code

7. Use of the FUCK directive

  1. Try typing firstbrew sear www.baidu.com, the result reported an error;
  2. And then you typefuck;
  3. She returns you a sentence with relatively correct grammar, and you pressenterThe key will execute the command. Pressctrl+cWill terminate the command. Isn’t that smart? Isn’t that fun?

Note: Fuck fun, but not necessarily accurate, do not fuck yo, command code or to have a look, wine is good, do not drink!

8. Modify the iTerm2 background

Many people must feel that the background of iTerm2 song how to change, CAN I change the photo of a teacher? Of course, the operation is shown in Figure 8.1.

  1. Click on the overhead menu barITerm2, the choice ofThe Preferences... :;
  2. In the new pop-up box, selectProfilesAnd then select the menu bar on the rightWindow;
  3. Click the red box to change the picture you prepared beforehand, and the blogger chose the one his wife liked bestSong song.BlendingCan adjust the transparency of the picture;
  4. There are also more tweaks to the appearance of iTerm2, such as fonts, colors, and so on.

Conclusion: Brew combined with iTerm2 style play MacOS software management terminal instructions, more fun plug-ins and knowledge, waiting for everyone to explore together.