Amazon.co.uk Widgets

Log in

X
zsh logo

Terminal prompt with architecture

Terminal on macOS and Ubuntu Desktop is a power tool and it can be made better. There are lots of shell customisation utilities around but the most useful to me at least in software development and devops, is zsh-powerline which is an implementation of powerline shell which was inspired by the powerline statusline plugin for vim.

For me, modifications must not hurt performance, and should not be distracting. Prompt based elements must be things I really need to know about the current environment right now.

The text colours for me are about the colours of terminals I used in the past at Sun Microsystems.

macOS Terminal screenshot showing the sysctl -n machdep.cpu.brand_string command on an Apple Silicon equipped Mac computer and an Intel based Mac computerWhen you ssh to an different computer with the same zsh environment the prompt changes. Thats what I need.

This prompt shows username, computername, architecture, git branch, exit status of the last command, OS symbol and shell prompt. As you can see when you ssh to an Intel based Mac it changes. Thats what I needed.

zsh-powerline with architecture

I forked zsh-powerline so that I could add my changes and keep them in github for easy redeployment on my Mac computers. You can find my changes here in the multizone branch. https://github.com/multizone-uk/zsh-powerline/tree/multizone Essentially I just assed a colour for the architecture prompt, and then added it to the prompt configuration and adjusted the prompt configuration to how I like it. Details are in the README.md. 

Terminal settings

I hardly ever touch the terminal settings on macOS but while I was doing this I made them a little better for me. Here they are in case they are useful. I like 132x50 as it reminds me of listing paper which was 132 columns wide. I need bigger fonts these days for my eyes.

Screenshot of teminal settings for text

Screenshot of teminal settings for window size 132x50

Text colours

Screenshot of teminal settings for text colour #FFCC46

Screenshot of teminal settings for text bold colour #FF801D

Screenshot of teminal settings for text colour #FFCC46

Using sysctl to find the exact processor installed in your Mac

It wasn't needed to make the prompt work, but along they way I discovered that the macOS sysctl command gives you branding information about the cpu in your Mac.

% sysctl -n machdep.cpu.brand_string