MacOs Command Line Interface Changes – Beyond $BASH & Terminal / ZSH / iTerm2 & OhMyZsh

Terminal Has Changed

Background

I’ve been on a voyage into what used to be known as the MacOs Terminal in these last few months, motivated by the need to get serious once and for all with the command line.

I also needed to get my MacMini completely up to date system-wise, as well as install an additional 1TB drive to handle more data. Catalina is a bit of a new era, and I wanted to get out in front of it. I must mention how useful Carbon Copy Cloner was. Incredible speeds, and restored my drives perfectly.

I was trying to set up and run a full Bitcoin node [more on that in another post] as well as needing to learn to use the console properly – specifically to get to grips with BitcoinD & Bitcoin -cli. And this was all part of the background prep I knew I had to complete in order to get going with the Ivan on Tech Academy Bitcoin Programming course I was trying to start. I’d moved to a new location with the latest fibre available, so the stars had aligned.

A few months prior, I’d installed a nice Linux distro called lubuntu onto an old Inspiron, and that had gone really well – and to be quite honest with you, I had a fever for more Command Line Interface.

Essentially, there have been significant [and good] changes in the way the MacOS Catalina handles what we knew as the ‘Terminal‘.

Let’s take it from the top.

The Basics

Let’s say there are three common types of personal computer operating systems;

  • LINUX based – Ubuntu or similar distribution
  • Microsoft PC – Windows
  • Apple Mac – MacOs

All of these operating systems have a deeper level of interacting. This isn’t machine code but it’s the next layer up, as you probably know. This basic level interface, opened in a separate window called a ‘shell‘ – and called the CLI, or Command Line Interface, is remarkably similar for each type of operating system. Not the same, but so similar as to be quite easy to move between all three once you get going with one.

  • terminal
  • command line
  • UNIX
  • bash
  • shell
  • ZSH
  • iTerm2
  • OHMYZSH!

_______________________________________

The Terminal is dead.

Long live the terminal.

$BASH Terminal Shell – Exit Stage Left

In computing, a shell is a user interface for access to an operating system‘s services. In general, operating system shells use either a command-line interface (CLI) or graphical user interface (GUI), depending on a computer’s role and particular operation. It is named a shell because it is the outermost layer around the operating system.[1][2]

Shell [Computing]

MacOs Catalina Replaces Terminal With ZSH

In researching this topic, I span off [again] into the question ‘Is MacOx UNIX?’.

The answer is, essentially, yes.

The reason this comes up is related to the $BASH shell that Terminal was based on.

B.A.SH stands for Bourne Again SHell, and there’s good reason the UNIX question comes up.

In any event, all you need to know is that the CLI is pleasantly similar across all machines, and for some reason, many people get put off by the CLI, so it’s a great skill to learn.

  • An A-Z Index of the Apple macOS command line (macOS bash) [pre-Catalina version]

It’s true that the old BASH shell is still there in the computers Apple are currently shipping, but they are phasing it out for sure, so now is a great time to get to know the new setup.

Apple has announced that in macOS 10.15 Catalina the default shell will be zsh.

Moving to zsh

The Z shell (Zsh)

The Z shell (Zsh) is a Unix shell that can be used as an interactive login shell and as a command interpreter for shell scripting. Zsh is an extended Bourne shell with many improvements, including some features of Bashksh, and tcsh.

Z shell – Wiki

Simple Steps;

Setting zsh as Your Default Shell


Users that have /bin/bash as their default shell on Catalina will see a prompt at the start of each Terminal session stating that zsh is now the recommended default shell. If you want to continue using /bin/bash, you can supress this message by setting an environment variable in your .bash_profile or .bashrc.

Moving to ZSH

Next, Install iTerm2

Visit iTerm2

The first thing you’ll notice is that the old $ ‘command prompt‘ has gone. You get a nice block cursor like the one in green above, next to the $. This is, briefly, confusing. But for all future code that you read, like UNIX code for LINUX, which still uses the BASH setup, you can just ignore the $ when you use the commands on your Mac. All the old commands still work, and there are plenty of newer and better ways to do things as well. There are some basic and significant differences that take a little effort in getting used to, but these are well worth it and make for a huge upgrade, all in all.

Once you’ve installed and switched to iTerm2, the next thing you want to do is install;

OH MY ZSH!

What is Oh My Zsh?

An open source, community-driven framework for managing your zsh configuration.

Your terminal never felt this good
Visit To Install

And then set up a theme that you like;

I Like This One

Summary

There’s never been a better time to get into the command line – and the more you learn, the easier it gets!

Further Reading

Celsius NetworkUnstoppable DomainsBRAVE BrowserCoinbase