Post

MacOS commands

MacOS commands

Use fingerprint for sudo

May need to uncomment a line, but this should be all that’s needed.

1
2
3
# sudo_local: local config file which survives system update and is included for sudo
# uncomment following line to enable Touch ID for sudo
auth       sufficient     pam_tid.so

Make VSCode use SSH keys for git

VS Code doesn’t use the SSH agent default for figuring out what key to use for git operations. Instead, the identity must also be in the Apple keychain.

1
2
~ ᐅ ssh-add --apple-use-keychain ~/.ssh/github_auth
Identity added: .ssh/github_auth (key-comment-field here)

Do this after editing ~/.ssh/config to point the keys to their respective git hosts.

1
2
3
4
5
6
# GitHub
Host GitHub
  Hostname github.com
  User git
  IdentityFile /path-to/home-dir/.ssh/github_auth
  PreferredAuthentications publickey

Update it all

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
function mac-updates {
  # Homebrew - https://brew.sh
  echo "Updating Homebrew ..."
  brew update
  brew upgrade
  brew cleanup

  # Vim configs - https://github.com/amix/vimrc
  echo "Updating Vim configs ..."
  cd .vim_runtime && python3 update_plugins.py && cd ..

  # tl;dr pages - https://tldr.sh
  echo "Updating tl;dr pages ..."
  tldr --update

  # GH CLI extensions - https://cli.github.com
  echo "Updating GitHub CLI extensions ..."
  gh extension upgrade --all

  # Helm - https://helm.sh
  echo "Updating Helm repos ..."
  helm repo update

  # Oh my zsh - https://ohmyz.sh
  echo "Updating Oh My Zsh ..."
  omz update

  # Nmap scripts - https://nmap.org
  echo "Updating Nmap scripts ..."
  nmap --script-updatedb

  # Update go modules
  echo "Updating public go modules ..."
  go install github.com/chainguard-dev/bincapz@latest
  echo "Updating private go modules ..."
  GOPRIVATE=github.com/ORG/REPO go install github.com/ORG/REPO@TAG

  # Update Python packages
  echo "Updating Python packages ..."
  pip3 freeze --local | grep -v '^\-e' | grep -v '@' | cut -d = -f 1 | xargs pip3 install -U --ignore-installed --break-system-packages
}
This post is licensed under CC BY-NC-SA 4.0 by the author.