MacOS Machine Setup

Image of Author
March 3, 2022 (last updated May 24, 2024)

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

ApplePressAndHoldEnabled is a macOS setting that, when true, will show little pop-up UI components that let you select accents and diacritical marks for certain characters. For example, holding down a will let you select an umlaut or an accent, etc.

To disable this behaviour you can do the following,

defaults write -g ApplePressAndHoldEnabled -bool false

Some additional notes:

  • see man defaults for more.
  • You have to either restart your application or restart your machine for the setting to take full effect(?)
  • You can check the current status with defaults read -g ApplePressAndHoldEnabled, where 1 is true and 0 is false.

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.

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