10

I was wondering - is there a way to make 'cal' (a terminal program) start the week on monday?

Usually it can be done with the -m flag, but this does not have any effect on the Mac. AFAIK, for freebsd you need deskutils, but I could not find any equivalent on the mac, even in homebrew.

Is there a switch or alternate source for a cal tool that allows weekday start changes?

12

GNU cal has a --starting-day option:

$ brew install gcal
$ alias cal='gcal --starting-day=1'
$ cal

      June 2013
 Mo Tu We Th Fr Sa Su
                 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

ncal also starts weeks on mondays by default:

$ ncal
    June 2013
Mo     3 10 17 24
Tu     4 11 18 25
We     5 12 19 26
Th     6 13 20 27
Fr     7 14 21 28
Sa  1  8 15 22 29
Su  2  9 16 23 30
  • Yeah, I was aware of that - which makes it even stranger. However, ideally I would prefer using 'cal' instead. Thanks for your answer though, it is appreciated. – user51200 Jun 13 '13 at 20:25
  • The cal of OSX has something different with GNU/Linux. I will use the gcal, thank you very much! – Chu-Saing Lai Jun 9 '15 at 9:31
5

This Macworld.com OS X Hint shows some scripting to put Monday first…

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) }'

Result:

      June 2013
 Mo Tu We Th Fr Sa Su
                 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 
  • this is really ugly but cool ! :-) – Julien Sep 22 '17 at 9:04
1

$ man cal says: "The cal utility displays a simple calendar in traditional format and ncal offers an alternative layout, more options and the date of easter. The new format is a little cramped but it makes a year fit on a 25x80 terminal. If arguments are not specified, the current month is displayed". To me, it seems preferable to use ncal as opposed to implementing an ugly hack.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .