The simplest way to display a calendar in the terminal is to use the cal command. It’s available in macOS, most Linux distros and even Windows through WSL.

Besides being so widely available (standard program on Unix and Unix-like OSes), cal is also user-welcoming. Running the command without any options will show the current month. To get the calendar for a whole year you just need to type the command followed by the year you wish to see e.g. cal 2022.

Year calendar in terminal

cal in macOS

cal in macOS is not the same as cal in, let’s say, Ubuntu. It’s an older or different version (I can’t figure out which one) with fewer options. One example is a very handy feature to highlight the current day. In Ubuntu it’s there, but missing in macOS.

The cal command in macOS

The cal command in Linux

You also won’t find the “-3” option which displays the previous, current and next month.

The previous, current, and next month with cal

And setting the week to start on Monday is not exactly trivial on macOS compared to Lubuntu. Okay, it’s a bit of a cheat to use ncal, but the point still stands that the version in macOS is has less features because of its age.

This:

ncal -Mb

Set week to start on Monday in cal (Linux)

vs this:

cal | awk '{
  print " "$0;
  getline;
  print " Mo Tu We Th Fr Sa Su";
  getline;
  if (substr($0,1,2) == " 1") print "                    1 ";
  do { 
    prevline=$0;
    if (getline == 0) exit;
    print " " substr(prevline,4,17) " " substr($0,1,2) " ";
  }
  while (1) 
}'

Set week to start on Monday in cal (macOS)

My mind takes me to the “Look What They Need to Mimic a Fraction of Our Power” meme. By the way, this code is from Mac OS X Hints. I recommend you check out that page as there are more examples there.

But is this complicated scripting what’s necessary to get a more powerful cal in macOS? Luckily, there’s gcal (GNU gcal) available through Homebrew. gcal has even more options than cal/ncal and if you want to read more, here’s a good post about it.