Mac Sequoia setup

Fri 30 May 2025 — Filed under notes; tags: mac

Yet another installation of my personal notes for setting up a new (or cleanly installed) MacOS computer. I will try really hard to reproduce the steps in an order that make then easiest to execute.

Note that none of the steps below require an Apple ID, but I did sign in from the start to make it easier to transfer links etc from a laptop during setup.

bootstrapping from another system

I do copy some things over from my previous computer, but it's pretty minimal. Here's the command to gather up what I need to transfer.

tar --exclude '.gnupg/S.*' -cf dotfiles.tar .aws .gitconfig .gnupg .netrc .pypirc .saml2aws .ssh

It's also handy to know all of the projects I'm working on:

cd ~/src
for dname in */.git; do git -C $(dirname $dname) remote -v; done > ~/remotes.txt

system update

The first thing I did this time around was to perform a system software update to get all of that waiting out of the way.

Developer tools

Also takes a while. This can be done from the command line:

xcode-select --install

system settings

The new iOS-style System Settings takes a bit of getting used to.

turn off spelling autocorrect

Search for "spelling" --> Spelling and Prediction --> unselect "Correct spelling automatically" and others

unmap Control + left,right

TODO: still necessary?

I use Control plus the left and right arrow keys to move between windows in emacs and tmux. Disable the default mapping to mission control:

System Settings --> Keyboard Shortcuts pane --> Keyboard Shortcuts button --> Mission Control -> uncheck mission control: move left/right a space

Turn on FileVault

System Settings --> Security & privacy --> FileVault

(this was actually enabled by work IT, but leaving here as a reminder)

Window management

Remove the default window margins

Desktop & Dock --> unselect "tiled windows have margins"

I have Ccontrol-Option-Command-m in muscle memory to maximize a window, so add a keyboard shortcut:

Keyboard --> Keyboard Shortcuts --> App Shortcuts --> + 
Menu title: Fill
Shortcut: ⌃⌥⌘M

homebrew

Still a one-liner, now bash rather than ruby:

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

Homebrew is installed to /opt/local on an Apple Silicon Mac. I add the path in my zsh profile like this:

if [[ -d /opt/homebrew ]]; then
    eval "$(/opt/homebrew/bin/brew shellenv)"
fi

CLI applications

Many packages are installed later with additional elaboration or in as dependencies for other applications; here are some more or less standalone packages that I routinely install up front.

brew install duckdb && \
brew install fd && \
brew install fswatch && \
brew install fzf && \
brew install gcc && \
brew install git && \
brew install graphviz && \
brew install htop && \
brew install jq && \
brew install latex2rtf && \
brew install mcfly && \
brew install node && \
brew install pandoc && \
brew install pngpaste && \
brew install rg && \
brew install tmux && \
brew install tree && \
brew install wget && \
brew install xsv

mactex (takes forever)

brew install --cask mactex

iTerm2

brew install --cask iterm2

Install using homebrew above. Update a few settings.

Settings –> Profiles –> Keys and do these things:

  • General: select "Left/right option key acts as": +Esc
  • Key Mappings: + –> Keyboard shortcut "OPT+<left arrow>": Send Escape sequence "b"
  • Key Mappings: + –> Keyboard shortcut "OPT+<right arrow>": Send Escape sequence "f"

(may have to delete or replace an existing mapping)

Default appearance:

  • Settings –> Profiles –> Colors –> Color Presets –> Light Background
  • Settings –> Profiles –> Text –> Change Font –> 14 point

Tabs on left:

  • Settings –> Appearance –> Tab Bar Location –> Left

Install shell integration:

curl -L https://iterm2.com/shell_integration/install_shell_integration.sh | bash
  • Install python runtime by selecting "Scripts" –> "Manage" –> "Install Python Runtime".
  • Enable the Python API under "Preferences" –> "General" –> "Magic"

zsh

zsh is the default shell on MacOS.

Install my dotfiles.

cd ~
git clone git@github.com:nhoffman/dotfiles.git
dotfiles/mac/bin/install_dotfiles.zsh

python

Sonoma ships with Python 3.9.6 as /usr/bin/python3 with no python executable (or maybe it's installed with xcode tools - I forgot to check). I avoid using the system python for the most part.

pyvenv

My current method for managing python interpreters is to use pyenv. See https://realpython.com/intro-to-pyenv/

brew install zlib
brew install pyenv
brew install pyenv-virtualenv

Install pyenv-update plugin:

git clone https://github.com/pyenv/pyenv-update.git $(pyenv root)/plugins/pyenv-update

added dotfiles/mac/zsh/pyenv.plugin.zsh

if [[ -d "$HOME/.pyenv" ]]; then
    # echo "using pyenv"
    export PYENV_ROOT="$HOME/.pyenv"
    export PATH="$PYENV_ROOT/bin:$PATH"
    eval "$(pyenv init --path)"
fi

Install the most recent versions of 3.8, 3.9 and 3.10 and set 3.10 as the default.

pyenv install $(pyenv install -l | grep '^  3.9' | tail -n1)
pyenv install $(pyenv install -l | grep '^  3.10' | tail -n1)
pyenv install $(pyenv install -l | grep '^  3.11' | tail -n1)
pyenv global $(pyenv install -l | grep '^  3.11' | tail -n1)
python3 -m pip install -U pip wheel

pyenv seems not to install a python entrypoint. I'll see how it goes with python3 only.

pipx

pipx is great for installing standalone python-language commands outside of project-level virtual environments.

Last time I installed pipx using homebrew, but at this time homebrew python is at 3.12 and I am primarily using 3.11. So I installed pipx into the pyenv global environment:

python3 -m pip install pipx

Install some globally useful packages:

pipx install awscli
pipx install pgcli

emacs

Since I moved off of Intel macs, I have been using the Homebrew emacs-plus project, which seems great so far.

brew install libressl
brew install aspell
brew install gpg
brew tap d12frosted/emacs-plus
brew install emacs-plus

Edit: after emacs 39.1 came out, I updated with:

brew uninstall emacs-plus
brew install emacs-plus@29 --with-imagemagick --with-native-comp

Check out my .emacs.d and run setup scripts.

cd ~
git clone git@github.com:nhoffman/emacs-config.git .emacs.d

Run setup scripts:

cd ~/.emacs.d
bin/python-setup.sh

The main inconvenience was having to adapt my startup script to juggle M1 Mac, x86 Mac, and linux. Here's the relevant portion.

if [[ $(uname) == 'Darwin' ]]; then
    if [[ $(uname -m) == 'arm64' ]]; then
	# assume we are using emacs-plus
	EMACS=/opt/homebrew/bin/emacs
	EMACS_BIN=/opt/homebrew/bin/emacsclient
    else
	EMACS=/Applications/Emacs.app/Contents/MacOS/Emacs
	EMACS_BIN=/Applications/Emacs.app/Contents/MacOS/bin
    fi
    alias emacs="$EMACS"
    # provides emacsclient
    export PATH=$EMACS_BIN:$PATH
else
    EMACS=$(readlink -f emacs)
fi

R

Installed the arm64 package from https://cran.r-project.org/bin/macosx/

Some packages that I know I'll need:

R --slave << EOF
packages <- c("lattice", "RSQLite", "latticeExtra", "argparse", "data.table", "tidyverse")
install.packages(packages, repos="http://cran.fhcrc.org/", dependencies=TRUE, clean=TRUE, Ncpus=4)
EOF

Also:

brew install --cask rstudio

postgresql

Install from https://postgresapp.com/downloads.html

This installs multiple versions of postgres. My zsh profiile includes the path to the CLI for the latest version, eg:

PATH="/Applications/Postgres.app/Contents/Versions/latest/bin:$PATH"

Docker desktop

Use Homebrew.

brew install --cask docker

Notes on Pelican hosting with GitHub Pages

Wed 25 December 2024 — Filed under python; tags: python read more

I've set up several Pelican sites on GitHub Pages and each time I seem to run into way more trouble than seems necessary. Here are a few details that I seem to need to rediscover each time.

Add themes …

Mac M2 Sonoma setup

Wed 17 April 2024 — Filed under notes; tags: mac read more

Python on an Arduino Nano RP2040 Connect

Sat 10 June 2023 — Filed under projects; tags: python, arduino read more

I recently purchased an Arduino Nano RP2040 Connect with the hope of running MicroPython (one of the useful side effects of having kids is an excuse to buy stuff for projects). It's worth noting a couple of the issues that …

Mac M2 Ventura setup

Wed 19 April 2023 — Filed under notes; tags: mac read more

Remap keys for emacs on a remote Windows machine

Sun 02 April 2023 — Filed under notes; tags: emacs, windows read more

I have been working on a Windows machine via remote desktop, and am gradually making it bearable. Emacs is miraculously easy to install to my user's account, but it was not immediately obvious how to reproduce my usual configuration of mapping Option to ESC. One solution is provided by Karabiner-Elements …

Mac M1 Monterey setup

Sat 23 July 2022 — Filed under notes; tags: mac read more

Yet another installation of my personal notes for setting up a new (or cleanly installed) MacOS computer …

Clean install of MacOS Big Sur

Thu 20 May 2021 — Filed under notes; tags: mac read more

Yet another installation of my personal notes for setting up a new (or cleanly installed) MacOS computer. The …

Clean install of MacOS Catalina

Sat 11 April 2020 — Filed under notes; tags: mac read more

Clean install of MacOS Mojave

Fri 15 February 2019 — Filed under notes; tags: mac read more