macOS as Unix Workstation 2022


Unix pro environment in macOS

I'm a die hard Linux user, but in November 2022, I had to use a Mac for some work. This document describes how I turned a vanilla install of the latest macOS into a powerful Unix workstation.

Emacs 🐂

Install Emacs from emacsformacosx.com, this gives you a good, up to date Emacs build.

Note, this build doesn't provide native compilation (aka "gccemacs"), nor the non-blocking JSON processing done in this emacs-lsp fork.

Update 2022-11-25: It's also possible to get Emacs with brew, from the documentation, I would've used these options to get native compilation and GUI (untested):

$ brew install --cask emacs --with-native-comp --with-cocoa

Homebrew 🍺

This is AFAIK the best package manager for Unix tools on macOS. Install it with:

$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Spell check 📖

$ brew install aspell

Terminal 💻

I've grown very fond of the kitty terminal. I believe it's the best terminal around, it even beats iTerm2 😃. It strikes a great balance between features (24 bit colours, Unicode, multiplexer, view pictures on remote servers, remote server clipboard integration++) and speed. Install it with:

$ curl -L https://sw.kovidgoyal.net/kitty/installer.sh | sh /dev/stdin

Set Caps Lock as Ctrl

Or else, I'll go seriously mad.

Head over to System preferences, then Keyboard and finally Modifier Keys.

Unix shell environment

Git

$ brew install git

ZSH 🐚

I prefer the ZSH shell over BASH, but still need an updated BASH for shell programming. The one that comes with macOS is very old, 3.2.57, so installing a newer bash with brew:

$ brew install zsh
$ brew install zsh-autosuggestions
$ brew install zsh-completions
$ brew install bash
$ brew install fzf

Coreutils 🧰

GNU coreutils, sed, awk, getopt and grep are superior to the ancient BSD tools that ship with macOS:

$ brew install coreutils
$ brew install gawk
$ brew install gsed
$ brew install gnu-getopt
$ brew install grep

Add this to your ~/.zshrc to ensure the GNU coreutils are first in PATH:

export PATH=\
/usr/local/bin:\
/usr/local/Cellar/gnu-sed/4.9/libexec/gnubin:\
/usr/local/opt/coreutils/libexec/gnubin:\
/usr/local/opt/gawk/bin:\
/usr/local/opt/gnu-getopt/bin:\
/usr/local/opt/grep/libexec/gnubin:\
/usr/local/opt/openjdk@11/bin:\
$PATH

As you can see from the above paths, gnused isn't packaged like the others, and doesn't provide a bin directory outside the cellar.

PGP 🔒

$ brew install gnupg

Java ☕

$ brew install openjdk@11

Ensure this JDK's binaries are first in PATH, add these to ~/.zshrc:

export PATH=/usr/local/opt/openjdk@11/bin:$PATH

Video meetings 📽️

My company uses Microsoft Teams, so that' the one to get.

Update 2022-11-22: Per told me Teams can also be installed with brew like so:

$ brew install --cask microsoft-teams

Fonts 🖊️

Download the excellent Adobce Source Code Pro font, unzip it and drag and drop the files to the Font Book:

install good looking font on macOS

A better top

btop is my favourite resource monitor these days, install it with:

$ brew install btop

That's it!

Your shiny macOS machine is now a good, modern Unix workstation with most of the same tools and versions as GNU/Linux distributions ship with.

Happy hacking!


Licensed under CC BY Creative Commons License ~ ✉ torstein.k.johansen @ gmail ~ 🐘 @skybert@emacs.ch ~ 🐦 @torsteinkrause