This is the third day of my participation in the First Challenge 2022.

Hi, I’m Milo, a blogger who shares testing/development techniques. Follow my official account: Milo’s test diary, and feel the charm of learning together.

A nice-looking terminal is enough to make a person feel relaxed and enticing to type in a few lines of command. Today we will talk about Mac and Windows under the topic of terminal beautification.

Manual installation version at the bottom of the article, too troublesome can directly skip over.

Terminal development

  • Windows

    As a product of a few years ago, cmder was quite capable of running on Windows. After all, there was no Windows Terminal or Git bash at that time, only empty cmd.exe

    Now, Windows Terminal has become the mainstream terminal under Windows. If you still use Powershell/CMD, you can try to download and install it.

    It’s actually a shell with a powershell or CMD core, which we’ll talk about later.

  • Mac

    The MAC situation is much better, although the system default terminal is not very good. But with the professional Iterm2 behind it, the MAC is really nice to use.

    With oh-my-zsh, any terminal can play 🌈!

As you can see from the above image, the visual impact of oh-my-ZSH is quite large. My MAC also has a slight configuration, but it is not in depth.

Back to the body

Read about a project called Oh-my-Posh the other day, the author has a very nice theme for Windows Terminal, and most importantly he supports MAC OS as well. The bottom line is go, cross-platform.

Without further ado, let’s get straight to the dry stuff:

Oh-my-posh 官网: ohmyposh. Dev /docs/window…

In fact, there is a very detailed installation tutorial on the official website, but because it is in English, SO I will give a rough introduction.

There are two ways to install oH-my-Posh, either by powershell/ Homebrew or by installing the version.

  1. Install modules through Powershell
  • windows

    It’s tedious. I get all kinds of weird problems on my computer.

    Reference address: zhuanlan.zhihu.com/p/354603010

    You can also refer to the configuration of Zhihu for subsequent configuration, including VScode configuration.

  • mac

    Ohmyposh. Dev /docs/macos

brew tap jandedobbeleer/oh-my-posh
brew install oh-my-posh
Copy the code

Unfortunately, I did not succeed in this step, there are many errors, and even need to install GO, so I choose the green version.

  1. Direct-mounted version

Github.com/JanDeDobbel…

Go to the Release page to download the installation version of the corresponding operating system.

Green version installation procedure

  • windows

    Open powershell.exe and see if you have the jandedobbeleer.omp.json theme file in your user directory. If not, download one:

    Github.com/JanDeDobbel…

If not, create a new one locally and replace the path with JSON
notepad $PROFILE

If vscode is installed, you can open it with VScode
# Code $PROFILE
Copy the code

Enter the following code in the notepad that appears:

oh-my-posh --init --shell pwsh --config ~/jandedobbeleer.omp.json | Invoke-Expression
Copy the code

After saving, restart PowerShell.

  • Mac

    MAC is a bit more complicated, once the green version is downloaded, we need to do some work on the file (I stomped like crazy until 1am myself).

  1. Make the downloaded file executable
chmod +x posh-darwin-amd64
Copy the code
  1. Put it in the user directory:
Create a theme directory
mkdir -p ~/opt/oh-my-posh/themes
# move to directory
mv posh-darwin-amd64 ~/opt/oh-my-posh/
# Build a soft chain
ln -s ~/opt/oh-my-posh/posh-darwin-amd64 /usr/local/bin/oh-my-posh
Copy the code

After doing this, type the command to test:

oh-my-posh
Copy the code

Don’t panic if something weird pops up, but the colors are there.

  1. Download the theme

Refer to the address above and save a JSON file locally, remembering the path.

  1. Determine whether you are bash or ZSH
oh-my-posh --print-shell
Copy the code

If the result is ZSH, change ~/.zshrc, if bash, change ~/.bashrc

  1. Add a line of code at the end of the file
# suppose ZSH
vim ~/.zshrc
Copy the code

Add a line at the end:

eval "$(oh-my-posh --init --shell ZSH --config theme json path you just downloaded)"
Copy the code
  1. Enable basHRC/ZSHRC
source ~/.bashrc
# source ~/.zshrc
Copy the code

When you restart the terminal, you see a lot of boxes. That’s because we need to install fonts.

Install the fonts

Installing fonts on Windows is easy, go to www.nerdfonts.com/font-downlo… Find the corresponding font:

Download and decompress, and then select the font right click to install.

Change fonts and use

After installing the font, we had to change it and open Windows Teriminal to enter the Settings page.

Open json file:

Add a new line in PowerShell (representing font change):

"fontFace": "DejaVuSansMono Nerd Font",
Copy the code

These are the default themes, so you can go to the official website and try out other themes.

Refer to the above zhihu article to change the theme in vscode:


Iterm2 ->prefrence-> set the font to a new font.

See what it looks like on my MAC:

Today’s content is a little long, because different system installation method is a little different, we can view for their own system, there are not understand the place welcome message ha!