Install a newer version of `less`

The version of less which ships in macOS Monterey (12.0) is 487, which was released in March 2017. Since then, it’s gained some features:

  • Line marking. Marking a line allows you to assign a shortcut letter to it to jump back.
  • Search result clearing.
  • Adds a status column, to show marks and indicate lines where search results are found.
  • Mouse support, so e.g. scrolling works in the document using the mouse.

At first it seemed like this may be the general problem of Apple disallowing GPL version 3 software, but less is dual-licensed to a more Apple-favorable one as well. It’s somewhat inexplicable that such a commonly-used command line library sees no updates.

Fortunately, it’s included in Homebrew. And even better, unlike the Apple distribution, they do not disable lesskey support, which allows specifying additional command and keyboard shortcuts for less to use.