MacOS Machine Setup

Image of Author
March 3, 2022 (last updated October 25, 2022)

Introduction

This is a link-first guide which walks through MacOS machine setup.

MacOS

Fast Keyboard

Type "cmd+space -> 'keyboard'" and set "Key Repeat" to fast and "Delay Until Repeat" to short.

Auth-hiding Dock

Right-click on the dock and click "Turn Hiding On"

Disable foreign-language hover on keydown

Turn off the behaviour where holding down some keys shows foreign-language characters

defaults write -g ApplePressAndHoldEnabled -bool false
  • I don't know much about how these settings work or are configured. man defaults for more.
  • You have to restart (or just log-out?) for the setting to take effect.
  • You can flip the bool back to true to reenable it.

Show sound in menu bar

Upper right action panel > Sound > Sound Preferences > Show sound in menu bar > always

Brew

https://brew.sh/

https://docs.brew.sh/Shell-Completion#configuring-completions-in-zsh

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

if type brew &>/dev/null
then
  FPATH="$(brew --prefix)/share/zsh/site-functions:${FPATH}"

  autoload -Uz compinit
  compinit
fi

Zsh

# ~/.zshrc

alias ..='cd ..'
alias g='git'
alias imps='iex -S mix phx.server'
alias l='ls -G'
alias ls='ls -G'
alias ll='ls -al'
alias nr='npm run'
alias v='vim'

Git

https://git-scm.com/

git config --global user.name [name]
git config --global user.email [email]

Git Aliases

# ~/.gitconfig
[alias]
        ap = add -p
        br = branch
        bra = branch --all
        co = checkout
        c = commit
        ca = commit --amend
        cane = commit --amend --no-edit
        cm = commit --message
        l = log
        lol = log --oneline
        lolg = log --oneline --graph
        l3 = log -3
        l5 = lol -5
        l9 = lol -9
        s = status --short
        st = status

Or, you can set the manually,

git config --global alias.ap "add -p"
# ...

I have a note on Git Aliases if you'd like to explore the topic further.

asdf

https://asdf-vm.com/

https://asdf-vm.com/guide/getting-started.html#_3-install-asdf

brew install asdf
# ~/.zshrc

. /usr/local/opt/asdf/libexec/asdf.sh
asdf plugin add [erlang elixir nodejs]

There's substantial overlap between what asdf and brew can do. In the past I've leaned heavily towards asdf, but have lately been swinging back towards using brew for tools and asdf for languages. One edge case at the moment is postgres. Not sure how I want it installed.

Hyper

https://hyper.is/

https://github.com/vercel/hyper#macos

I used to install from brew, but last time I reimaged I couldn't find it. I am downloading the binary directly from their site. It doesn't seem ideal.

You can change font size and other configuration parameters in ~/.hyper.js. The docs are confusing. They act like ~/.hyper.js is deprecated but the place they claim it exists is empty while ~/.hyper.js is full of reasonable defaults that are safer to edit.

The only settings I change are the following:

"fontSize": 14,
"fontFamily": '"FiraCode Nerd Font Mono", ...'

The "fontFamily" font doesn't exist yet, you will add it in #Fira Code Nerd Font.

Fira Code Nerd Font

You need to install a "Nerd Font" in order for the default starship behavior to display correctly. You will also need to update any editors that display a terminal. For me, that is Hyper and the VSCode terminal.

https://github.com/Homebrew/homebrew-cask-fonts

https://www.programmingfonts.org/#firacode

brew tap homebrew/cask-fonts
brew install font-fira-code-nerd-font

(In iTerm2, if you choose to install it, go to Preferences > Profiles > Text > Font, "FireCode Nerd Font Mono" should "just show up", and when selected, the icons should "just work".)

In VSCode, once you install it, go to User Settings > Editor: Font Family. It can be prepended with "FiraCode Nerd Font Mono, ..." and it should "just work". You should see icons in the integrated terminal, etc. Terminal inherits from this, but you can also set the terminal font independently in "Terminal > Integrated: Font Family".

https://hyper.is/#config-location

In Hyper, you prepend ~/.hyper.js > "fontFamily" with '"FiraCode Nerd Font Mono", ...' and it should "just work". See #Hyper section for more details.

Starship

https://starship.rs/

https://starship.rs/config/#prompt

brew install starship
# ~/.zshrc

eval "$(starship init zsh)"

Docker

https://docs.docker.com/desktop/mac/install/

https://github.com/jesseduffield/lazydocker

brew install --cask docker
brew install lazydocker

VSCode

https://code.visualstudio.com/

https://code.visualstudio.com/docs/editor/settings-sync

https://code.visualstudio.com/docs/editor/vscode-web

brew install visual-studio-code

As long as you have settings-sync enabled, everything "just works".

gh: The Github CLI

https://cli.github.com/

You will want gh to clone repos, including the upcoming #Vim setup.

Before install, set up your preferred browser, and any other utilities you need to be logged in to Github on your default browser. You want to be logged in to Github and authorize the new client. (By default gh uploads a new SSH key.)

brew install firefox

Opening Firefox for the first time prompts me to make it the default browser. This will "magically" have the browser-based gh auth flow open in Firefox.

brew install gh
gh auth login

Vim

I keep my ~/.vim/ folder source controlled at aegatlin/dotvim. For more information, see my note on the Vim Builtin Package Manager.

cd ~
gh repo clone dotvim .vim

Conclusion

There is more setup to do from here, but this is a good starting point, and a good place to end this guide.

Thanks for reading :D