MacOS and the command line

I’ve spent decades using the Linux command line on a daily basis. Six months ago, I switched to a MacBook Pro as my day-to-day machine, and I’m still learning to acclimatize. Happily, many of the tools I’ve grown to love still work on MacOS, either because they’re shipped with it (ssh, git, python3, zgrep, zip, less, curl), or because I’ve installed them with “brew install …”

  • vim
  • ripgrep ‘rg’
  • tree
  • xz
  • socat
  • shellcheck
  • tcptraceroute
  • screen
  • jq
  • jhead
  • htop
  • coreutils

Things that are subtly different, and still annoy me:

  • find lacks a -mindepth option, so install “coreutils” and use “gfind”
  • bash 3 is ancient and doesn’t work like modern bash 5, so use zsh instead
  • grep lacks -P. Happily, -E gets me most of what I want, and when it doesn’t, I use “ggrep” (brew install ggrep) or “pcre2grep” (brew install pcre2) instead.
  • cat doesn’t respond to CTRL-D, so use CTRL-C instead, or use “gcat” from “coreutils”
  • ps is very different, and lacks a –forest option, so install and use “pstree”
  • zcat doesn’t use gzip. It handles compress Z files. So use “bzcat” , or “gzcat” from “coreutils”.
  • no sha256sum, md5sum, etc., so run “brew install coreutils” to get them.

There’s far more, under-the-hood, that is different, but I haven’t run into those things as much, yet. I’m still more comfortable with Linux, but I’m glad that “brew install” gives me so much. Thank you to the people who maintain ‘brew’ and the packages.

MacOS and keyboard shortcuts

Last August, I gave up my four-year-old Linux T590 Thinkpad for a MacBook Pro. They’re different, and in some aspects, it’s been a difficult journey because MacOS is not Linux. In other ways (apps, audio, Bluetooth, etc.), MacOS has been fantastic.

The hardest thing to get used to is the keyboard shortcuts. I use keyboard shortcuts extensively, and they’re quite similar between Windows and Gnome Desktop. Not so with MacOS. MacOS is not Gnome, and it’s not Windows either.

Shortcuts that I still get wrong, six months later, and so I’m still learning.

  • I hit CMD-Home, expecting to go to the top of the web browser window, or the top of a document.
  • I hit CMD-up-arrow to go to the beginning of the line, and does something else. On Windows/Gnome, CTRL-up-arrow does what I expect. On Mac, it’s CONTROL-A, and CONTROL-E to move to the end of the line, just like with zsh and bash (by default), so I can accept that.
  • F2 in the Finder doesn’t rename files. Apparently, the Return key does this instead. I can get used to that.
  • In PyCharm, I still don’t know how to set and jump to bookmarks.

Mac doesn’t have window-snapping like Gnome or Windows, so I use Rectangle to remedy that. Although the keyboard shortcuts are different, I’ve gotten used to them.

Now that I use Mac during the workday, I’m used to starting apps with COMMAND-space. When I use our at-home Windows computer or my Linux computer, it takes me a few seconds to adjust to the different shortcut keys — just hit the windows key, no space bar needed.

The differences under-the-hood are far more striking than the keyboard-shortcut differences, but that’s a topic for another day.