In the previous article, we explore the Terminal, why it is there in macOS, and why people still using it despite one could say everything is graphically based. We touched a bit on the basic stuff and now we explore some programs that come with it.

Homebrew


Homebrew is a package manager that was originally built for macOS. What is a package manager? Imagine it is like an app store but for your terminal. It has a collection of small programs that we call packages. Homebrew manages them by helping you install them, update the package where necessary, and download all the supporting packages where required.

To install Homebrew, head over to their website. The first section of the home page contains the instructions to install Homebrew on your machine. Just copy-paste the command and press enter. You will need the administrator password to complete the installation. During installation, it will explain everything that it is doing.

You can browse all the little packages that they have (called formulae) from different libraries (called caskets). Homebrew is the gateway to getting the rest of the program mentioned below.

Weather apps

There’s one thing that everyone talks about, but nobody can do something about it. It’s the weather. Weather is important since it can help or derail your plans for the day. Here are two command line suggestions for you to quickly get weather information.

Before, we had darksky, but since Apple bought it over, we have to rely on other methods.

First is ANSI weather. To access it, install ansiweather using homebrew:

brew install ansiweather

Just type ansiweather to get local info. If you need a specific location, add the -l <city name> flag.

ansiweather -l "New York City"
 Weather in New York: 7 °C - UVI: 5.79 - Wind: 6.17 m/s NNE - Humidity: 89% - Pressure: 1013 hPa 

Alternatively, you can use the curl command to retrieve info from a website and it gives you more detailed info in a nice form.

erwinkarim@Erwins-Mac-mini Music % curl wttr.in/Paris
Weather report: Paris

       .-.      Light rain
      (   ).    +10(8) °C      
     (___(__)   ↑ 11 km/h      
      ‘ ‘ ‘ ‘   10 km          
     ‘ ‘ ‘ ‘    0.6 mm         
                                                       ┌─────────────┐                                                       
┌──────────────────────────────┬───────────────────────┤  Wed 03 Apr ├───────────────────────┬──────────────────────────────┐
│            Morning           │             Noon      └──────┬──────┘     Evening           │             Night            │
├──────────────────────────────┼──────────────────────────────┼──────────────────────────────┼──────────────────────────────┤
│      .-.      Light drizzle  │  _`/"".-.     Light rain sho…│  _`/"".-.     Patchy rain ne…│  _`/"".-.     Patchy rain ne…│
│     (   ).    10 °C          │   ,\_(   ).   +13(12) °C     │   ,\_(   ).   +14(13) °C     │   ,\_(   ).   +12(11) °C     │
│    (___(__)   ↗ 5-7 km/h     │    /(___(__)  ↗ 21-25 km/h   │    /(___(__)  ↗ 18-25 km/h   │    /(___(__)  ↗ 19-29 km/h   │
│     ‘ ‘ ‘ ‘   2 km           │      ‘ ‘ ‘ ‘  10 km          │      ‘ ‘ ‘ ‘  10 km          │      ‘ ‘ ‘ ‘  10 km          │
│    ‘ ‘ ‘ ‘    0.3 mm | 100%  │     ‘ ‘ ‘ ‘   0.2 mm | 100%  │     ‘ ‘ ‘ ‘   0.1 mm | 100%  │     ‘ ‘ ‘ ‘   0.0 mm | 78%   │
└──────────────────────────────┴──────────────────────────────┴──────────────────────────────┴──────────────────────────────┘
                                                       ┌─────────────┐                                                       
┌──────────────────────────────┬───────────────────────┤  Thu 04 Apr ├───────────────────────┬──────────────────────────────┐
│            Morning           │             Noon      └──────┬──────┘     Evening           │             Night            │
├──────────────────────────────┼──────────────────────────────┼──────────────────────────────┼──────────────────────────────┤
│  _`/"".-.     Light rain sho…│  _`/"".-.     Patchy rain ne…│  _`/"".-.     Patchy rain ne…│      .-.      Light drizzle  │
│   ,\_(   ).   +12(10) °C     │   ,\_(   ).   15 °C          │   ,\_(   ).   16 °C          │     (   ).    +13(12) °C     │
│    /(___(__)  ↗ 26-35 km/h   │    /(___(__)  ↗ 27-34 km/h   │    /(___(__)  ↗ 20-24 km/h   │    (___(__)   ↗ 17-24 km/h   │
│      ‘ ‘ ‘ ‘  10 km          │      ‘ ‘ ‘ ‘  10 km          │      ‘ ‘ ‘ ‘  10 km          │     ‘ ‘ ‘ ‘   2 km           │
│     ‘ ‘ ‘ ‘   0.4 mm | 100%  │     ‘ ‘ ‘ ‘   0.1 mm | 100%  │     ‘ ‘ ‘ ‘   0.0 mm | 85%   │    ‘ ‘ ‘ ‘    0.3 mm | 100%  │
└──────────────────────────────┴──────────────────────────────┴──────────────────────────────┴──────────────────────────────┘
                                                       ┌─────────────┐                                                       
┌──────────────────────────────┬───────────────────────┤  Fri 05 Apr ├───────────────────────┬──────────────────────────────┐
│            Morning           │             Noon      └──────┬──────┘     Evening           │             Night            │
├──────────────────────────────┼──────────────────────────────┼──────────────────────────────┼──────────────────────────────┤
│    \  /       Partly Cloudy  │    \  /       Partly Cloudy  │    \  /       Partly Cloudy  │    \  /       Partly Cloudy  │
│  _ /"".-.     +15(13) °C     │  _ /"".-.     19 °C          │  _ /"".-.     19 °C          │  _ /"".-.     16 °C          │
│    \_(   ).   ↑ 18-25 km/h   │    \_(   ).   ↗ 21-24 km/h   │    \_(   ).   ↑ 12-19 km/h   │    \_(   ).   ↖ 8-16 km/h    │
│    /(___(__)  10 km          │    /(___(__)  10 km          │    /(___(__)  10 km          │    /(___(__)  10 km          │
│               0.0 mm | 0%    │               0.0 mm | 0%    │               0.0 mm | 0%    │               0.0 mm | 0%    │
└──────────────────────────────┴──────────────────────────────┴──────────────────────────────┴──────────────────────────────┘
Location: Paris, Île-de-France, France métropolitaine, 75000;75001;75002;75003;75004;75005;75006;75007;75008;75009;75010;75011;75012;75013;75014;75015;75016;75017;75018;75019;75020;75116, France [48.8566101,2.3514992]

Cal

cal gives you the calendar right on your terminal. By default, it gives you the current month. Adding the month and year after the command gives you the monthly calendar for the requested month.

cal

Below are some more examples:

erwinkarim@Erwins-Mac-mini Music % cal
     April 2024       
Su Mo Tu We Th Fr Sa  
    1  2  3  4  5  6  
 7  8  9 10 11 12 13  
14 15 16 17 18 19 20  
21 22 23 24 25 26 27  
28 29 30      

erwinkarim@Erwins-Mac-mini Websites % cal 12 2024
   December 2024      
Su Mo Tu We Th Fr Sa  
 1  2  3  4  5  6  7  
 8  9 10 11 12 13 14  
15 16 17 18 19 20 21  
22 23 24 25 26 27 28  
29 30 31     

Tree

The tree command gives you a more detailed look at your directory. Instead of going through folder by folder in your finder, tree dumps everything right at your Terminal. You can limit the depth by using the -L <number> flag.

In the example below, I limit the depth at 2 levels when displaying my Music folder.

brew install tree
erwinkarim@Erwins-Mac-mini Music % tree -L 2
.
├── Audio Music Apps
│   ├── Alchemy Samples
│   ├── Custom Icons
│   ├── Databases
│   ├── Patches
│   ├── Plug-In Settings
│   ├── Project Templates
│   └── Sampler Instruments
├── GarageBand
│   ├── TEST.band
│   └── Untitled.band
├── Music
│   ├── Media.localized
│   ├── Music Library.musiclibrary
│   └── Previous Libraries.localized
└── iTunes
    ├── Album Artwork
    ├── iTunes Library Extras.itdb
    ├── iTunes Library Genius.itdb
    ├── iTunes Media
    └── sentinel

cmatrix

In the 1999 movie, The Matrix, there is a cool screen saver where there are lines of code falling down the screen. Now you can do it on the Terminal right on your Mac. Install cmatrix and run that command to bring nostalgia back. Press ctrl + c to exit.

brew install cmatrix
cmatrix

fortune

fortune retrieves a quote from their internal database and prints it out for you. Great if you are looking for some inspiration. Install fortune from Homebrew and just run the command.

brew install fortune
erwinkarim@Erwins-Mac-mini Websites % fortune
Help!  I'm trapped in a PDP 11/70!
erwinkarim@Erwins-Mac-mini Websites % fortune
Santa Claus is watching!
erwinkarim@Erwins-Mac-mini Websites % fortune
Heuristics are bug ridden by definition.  If they didn't have bugs,
then they'd be algorithms.
erwinkarim@Erwins-Mac-mini Websites % fortune
How many "coming men" has one known!  Where on earth do they all go to?
		-- Sir Arthur Wing Pinero
erwinkarim@Erwins-Mac-mini Websites % fortune
	"The glory of creation is in its infinite diversity."
	"And in the way our differences combine to create meaning and beauty."
		-- Dr. Miranda Jones and Spock, "Is There in Truth No Beauty?",
		   stardate 5630.8
erwinkarim@Erwins-Mac-mini Websites % fortune
I'm reporting for duty as a modern person.  I want to do the Latin Hustle now!
erwinkarim@Erwins-Mac-mini Websites % 

What’s Next

Those apps are just a taste of what’s possible on the command line. In the next article, we can explore more advanced topics like advanced file manipulation, how to connect to other machines, and eventually starting up development projects. Stay tuned for more.

Plug

Support this free website by visiting my Amazon affiliate links. Any purchase you make will give me a cut without any extra cost to you

BasePro
iPhonesiPhone 15 / iPhone 15 Plus (Renewed) - (Amazon)iPhone 15 Pro / iPhone 15 Pro Max (Renewed) - (Amazon)
WatchApple Watch SE (Amazon) / Apple Watch Series 9 (Amazon)Apple Watch Ultra 2 (Amazon)
AirPodsAirPods 3 (Amazon)AirPods Pro 2 (Amazon) / AirPods Max (Amazon)
iPadiPad 10 (Amazon) / iPad Mini (Amazon)iPad Air M2 (Amazon) / iPad Pro M4 (Amazon)
LaptopsMacBook Air M3 (Amazon)MacBook Pro M3 (Amazon) / MacBook Pro M3 Pro/Max (Amazon)
DesktopMac Mini (Amazon) / iMac (Amazon)Mac Studio / Mac Pro
DisplaysStudio Display (Amazon)Pro Display XDR (Amazon)

Other Ecosystem Items