Skip to content

Latest commit

 

History

History
272 lines (200 loc) · 8.05 KB

macos.md

File metadata and controls

272 lines (200 loc) · 8.05 KB

macOS

Initial setup

# n.b. svn is needed to install the font-source-code-pro cask
brew install \
    bash \
    coreutils \
    curl \
    jq \
    nmap \
    svn \
    tmux \
    watch \
    wget \
    vim

# Fonts
brew tap homebrew/cask-fonts
brew install \
  --cask font-source-code-pro \
  font-droid-sans-mono-nerd-font \
  font-inconsolata \
  font-source-code-pro \
  font-ubuntu

# Change shell to Bash
echo '/opt/homebrew/bin/bash' | sudo tee -a /etc/shells
chsh -s /opt/homebrew/bin/bash

Install these applications:

brew install --appdir ~/Applications/ --no-quarantine alacritty flameshot karabiner-elements rectangle

Add CLI launcher scripts:

~/.local/bin/alacritty

#!/usr/bin/env bash
open --new ~/Applications/Alacritty.app --args $@

~/.local/bin/code

#!/usr/bin/env bash
open --new -a 'Visual Studio Code' --args $@

Enable font smoothing:

defaults write -g CGFontRenderingFontSmoothingDisabled -bool NO
defaults -currentHost write -globalDomain AppleFontSmoothing -int 2

Show all files in the Finder

defaults write com.apple.Finder AppleShowAllFiles YES

Keyboard Shortcuts

All shortcuts

Meta keys:

  • Command ⌘
  • Shift ⇧
  • Option (Alt) ⌥
  • Control (Ctrl) ⌃
  • Caps Lock ⇪
  • Fn
Key combination Description
Control Command Space Open Emoji Viewer
Command Shift . Show hidden files
Command n New window
Control Command q Lock screen
/ Go to a directory when focussed on a Finder window

Rebind these shorcuts in System Settings > Keyboard > Shortcuts > Mission Control:

Key combination Description
F3 Mission Control
⌘ ← Mission Control: Move left a space
⌘ → Mission Control: Move right a space

Add a "Paste and Match Style" shortcut in System Settings > Keyboards > Shortcuts > App Shortcuts

Field Value
Application All Applications
Menu Title Paste and Match Style
Keyboard Shortcut ⇧⌘V

Customizations

Reduce menu (top bar) transparency

  1. Navigate to: Accessibility > Display > Display (tab)
  2. Enable: Reduce transparency

Dock

# Hide Dock
defaults write com.apple.dock autohide -bool true && killall Dock
defaults write com.apple.dock autohide-delay -float 1000 && killall Dock
defaults write com.apple.dock no-bouncing -bool TRUE && killall Dock

# Restore Dock
defaults write com.apple.dock autohide -bool false && killall Dock
defaults delete com.apple.dock autohide-delay && killall Dock
defaults write com.apple.dock no-bouncing -bool FALSE && killall Dock

Disable "Click wallpaper to reveal desktop"

  1. Open "System Settings"
  2. Search for "stage manager"
  3. Set "Click wallpaper to reveal desktop" to "Only in Stage Manager"

Disable command+h (hide window)

  1. Install Karabiner-elements
  2. Import and enable the Prevent unintended command-h "complex modification rule"

KVM

  1. System Preferences -> Energy Saver -> Power Adapter
  2. Enable: "Enable Power Nap while plugged into a power adapter"

Fix flakiness

$ cat ~/Library/Preferences/display-switch.ini
# Logs are in:
# $ tail -F ~/Library/Logs/display-switch/display-switch.log
# USB Devices:
# * 14b0:011e StarTech.com Ltd. USB 3.0 4 Port HUB
# * 1532:0e03 1532 Razer Kiyo
# The Genesys is the KVM. It is not added/removed when switching ports, so we must use another device such as the StarTech hub.
usb_device = "1532:0e03"
on_usb_connect = "DisplayPort1"
#on_usb_disconnect = "DisplayPort1"

$ launchctl load ~/Library/LaunchAgents/dev.haim.display-switch.daemon.plist

# Unload with:
# $ launchctl load ~/Library/LaunchAgents/dev.haim.display-switch.daemon.plist
sudo apt install libudev-dev i2c-tools
sudo usermod ${USER} -aG i2c

# Save config to:
# ~/.config/display-switch/display-switch.ini

Troubleshooting

Increase maxfiles

$ echo 'ulimit -n 65536 104857' >> ~/.bashrc

$ cat <<-END >> /etc/sysctl.conf
kern.maxfiles=10485760
kern.maxfilesperproc=104857
END

Bypass macOS app installation restrictions

xattr -d com.apple.quarantine /Applications/...app

Fix OpenSSL errors

curl -Lks 'https://git.io/rg-ssl' | ruby
brew info openssl
sudo cp /usr/local/etc/openssl\@1.1/cert.pem  /opt/local/etc/openssl/cert.pem

Reinstall xcode

# Get Xcode version
xcode-select  --version

# Re-install Xcode CLI tools
sudo rm -rf /Library/Developer/CommandLineTools
sudo xcode-select --install

Remove RODE Connect virtual audio devices

After installing RODE Connect - in order to upgrade RODE NT-USB Mini drivers - 3 new virtual audio devices are installed. To remove them:

  1. Navigate to: Macintosh HD > Library > Audio > Plug-ins > HAL
  2. Delete the "RODE ..." folder

Prevent Google Meet from changing the input device volume level

  1. Run open -a 'Audio MIDI Setup'
  2. Click the "+" icon in the bottom-right
  3. Click "Create Aggregate Device"
  4. Add only your input device, eg. "RODE NT-USB Mini"
  5. Option/Alt+click the sound icon in the macOS taskbar
  6. Select the newly created Aggregate Device as the default input device

Restart audio system

sudo launchctl kickstart -kp system/com.apple.audio.coreaudiod

External monitor flickers

If your monitor support Variable Refresh Rate (VRR), such as AMD FreeSync or nVidia Gsync, then VRR will be enabled in System Preferences > Displays, which may cause flickering. Even if disabled manually, rebooting or disconnecting/reconnecting the monitor will re-enable the setting.

Workaround: Disable VRR in your monitor's OSD.