Skip to content

tungd/dotfiles

Repository files navigation

macOS Setup

Bootstrap

Install my SSH and GPG keys

Fix macOS Sierra ssh-agent issue

cat >> ~/.ssh/config <<EOF
Host *
    IdentityFile ~/.ssh/id_rsa
    AddKeysToAgent yes
EOF

Clone the dotfiles

mkdir -p ~/Projects
git clone git@github.com:tungd/dotfiles-lean.git ~/Projects/dotfiles

Making aliases

mkdir -p ~/.local/bin

ln -s ~/Projects/dotfiles/.bash_profile ~/.bash_profile
ln -s ~/Projects/dotfiles/.bashrc ~/.bashrc
ln -s ~/Projects/dotfiles/.emacs.d ~/.emacs.d
ln -s ~/Projects/dotfiles/.gitconfig ~/.gitconfig
ln -s ~/Projects/dotfiles/.npmrc ~/.npmrc
ln -s ~/Projects/dotfiles/.eslintrc ~/.eslintrc

Install apps and utilities

XCode

xcode-select --install

macports

I don’t use Homebrew, it is too fragile and invasive for my taste. I tried Nix but it’s not ready for prime time yet. Deal breaker for me is a long standing issue regarding watchman (NixOS/nixpkgs#14309).

I tried pkgsrc, it was great but the number of packages are so limited, and updates were so infrequent. I now settled down with MacPorts. It is simple, pretty similar to apt and yum, supports package version pining and has all of the packages that I need. It’s also not updated too frequently like Homebrew. Installation is a little bit more involved, though.

# the general stuffs
sudo port install aspell aspell-dict-en automake autoconf openssl htop
sudo port install kubectl-1.24 terraform-1.2
sudo port install watchman sqlite3 ripgrep tree libxml2 lcms2
sudo port install nodejs18 npm8 yarn python3.10 py310-pip py310-awscli postgresql14
sudo port install texinfo gnutls jansson
sudo port install z direnv
sudo port install emacs-app-devel

AWS Session Manager plugin

cd /tmp
curl "https://s3.amazonaws.com/session-manager-downloads/plugin/latest/mac_arm64/sessionmanager-bundle.zip" -o "sessionmanager-bundle.zip"
unzip sessionmanager-bundle.zip
./sessionmanager-bundle/install -i ~/.local/lib/aws-ssm -b ~/.local/bin/session-manager-plugin
curl -L https://raw.githubusercontent.com/qoomon/aws-ssm-ec2-proxy-command/master/aws-ssm-ec2-proxy-command.sh -o ~/.local/aws-ssm-ec2-proxy-command.sh
chmod +x  ~/.local/aws-ssm-ec2-proxy-command.sh
cat >> ~/.ssh/config <<EOF
Host i-* mi-*
  IdentityFile ~/.ssh/id_rsa
  ProxyCommand ~/.local/aws-ssm-ec2-proxy-command.sh %h %r %p ~/.ssh/id_rsa.pub
  StrictHostKeyChecking no
EOF

System configuration

Keyboard configuration

Decrease repeat delay, increase repeat rate and disable Emoji.

defaults write -g ApplePressAndHoldEnabled -bool false
# defaults write -g InitialKeyRepeat -int 10
defaults write -g KeyRepeat -int 1
defaults write -g NSUserKeyEquivalents -dict-add 'Emoji & Symbols' '@^j'

No shadow on window capture (Cmd-S-4 SPC)

defaults write com.apple.screencapture disable-shadow -bool true