Skip to content

Instantly share code, notes, and snippets.

@benlind
Last active January 26, 2026 20:50
Show Gist options
  • Select an option

  • Save benlind/7dc0e196a7ae59fa1d867bce153258fc to your computer and use it in GitHub Desktop.

Select an option

Save benlind/7dc0e196a7ae59fa1d867bce153258fc to your computer and use it in GitHub Desktop.
New Mac Environment Setup

New Mac Environment Setup

These items are ordered by priority to reduce annoyance when first setting up a new mac.

TODO

Set up Emacs-like keyboard shortcuts everywhere

mkdir ~/Library/KeyBindings ; vim ~/Library/KeyBindings/DefaultKeyBinding.dict

Enter the following code:

{
  // Mac has built-in C-k support, but it doesn't put the killed text onto the
  // system clipboard (you have to C-y to access the killed value). The
  // following line puts it on the clipboard instead.
  "^k" = (setMark:, moveToRightEndOfLineAndModifySelection:, cut:);
  "^ " = setMark:;
  "^/" = undo:;
  "^w" = deleteToMark:;
  "^v" = pageDown:;
  "~b" = moveWordBackward:;
  "~c" = (capitalizeWord:, moveForward:, moveForward:);
  "~d" = deleteWordForward:;
  "~f" = moveWordForward:;
  "~l" = (lowercaseWord:, moveForward:, moveForward:);
  "~u" = (uppercaseWord:, moveForward:, moveForward:);
  "~v" = pageUp:;
  "~w" = (deleteToMark:, setMark:, yank:, swapWithMark:);
  "~B" = moveWordBackwardAndModifySelection:;
  "~F" = moveWordForwardAndModifySelection:;
}

(The "~ " one gets Mac to not insert non-breaking spaces on Opt + Space.)

You can verify that this worked by restarting Chrome and then doing Opt + F/B in the URL bar. It should do word forward/backward instead of printing glyphs.

Disable the press-and-hold for accents feature to enable key repeating:

defaults write -g ApplePressAndHoldEnabled -bool false

Install Chrome

To avoid having to use Touch ID every time you autofill a password, go to chrome://password-manager/settings and toggle off the "Use your screen lock when filling passwords" setting.

Log into iCloud

Do this in System Preferences.

Install 1Password

Also install the 1Password Chrome extension. This might automatically be done for you when you sign into Chrome. You will need to get the classic extension which doesn't require a 1Password account.

Set up Mac OS Preferences

  • Accessibility
    • Display > Pointer > Shake mouse pointer to locate: off
  • Appearance
    • Appearance: Dark
    • Click in the scroll bar to: Jump to the spot that's clicked
  • Menu Bar
    • Sound > Always Show
  • Desktop & Dock
    • Automatically hide and show dock: on
    • Close windows when quitting an app: off
    • Hot Corners:
      • Top left: none
      • Top right: none (RIP Dashboard)
      • Bottom right: Start Screen Saver
      • Bottom left: Desktop
  • Siri: disabled
  • Touch ID & Password
    • Touch ID: Add both index fingers and the right index finger twice (for better coverage)
    • Use Touch ID for autofilling passwords: off (so Safari will autofill without a prompt)
    • Unlock with Apple Watch: on
  • Sound
    • Play sound on startup: off
  • Keyboard
    • Keyboard
      • Key Repeat: fastest
      • Delay Until Repeat: one short of fastest
    • Text input > Input Sources > Edit...
      • Add period with double-space: off
  • Trackpad
    • Point & Click
      • Tracking speed: slightly below middle
      • Tap to click: on
      • Quiet Click: on
      • Force Click: off
    • More Gestures
      • Swipe between pages: off
  • Mouse
    • Scroll direction: Natural
    • Secondary click: on
    • Tracking speed: one above middle
  • Displays
    • Night Shift: Sunset to Sunrise
  • Lock Screen
    • Battery: Turn display off after 10 minutes

This is necessary because if you uncheck Mouse > Natural Scrolling that will also reverse the trackpad.

I tried UnnaturalScrollWheels because Scroll Reverser says it will one day be paid, but UnnaturalScrollWheels doesn't reverse magic mice.

Show hidden Finder files

Cmd + Shift + .

I store my Karabiner config in iCloud Drive. Remove the existing config dir at ~/.config/karabiner and then run:

ln -s $HOME/Library/Mobile\ Documents/com~apple~CloudDocs/config/karabiner ~/.config

Follow the instructions on the Karabiner page to set up system permissions.

If using an external keyboard, set up its custom keymappings.

You can get per-device customization in Complex Modifications (e.g., opening a different app on a personal laptop) by using device_if conditions (see the Cmd + 2 modification as an example).

Configure iTerm

This comes bundled with Mac now.

I have uploaded some starter settings for iTerm here. Go to iTerm > Preferences > General > Settings and check "Load preferences from a custom folder or URL" to use this file.

Make iTerm the system default terminal via iTerm2 > Make iTerm2 Default Term.

Note, you will need to install Oh My Zsh and fzf first.

You can also install Powerline/powerlevel10k first to get fancy prompts. Then configure it:

  • Disable the git branch name truncation
  • Disable listing the number of git stashes in the prompt by editing ~/.p10k.zsh and commenting out the VCS_STATUS_STASHES line (I couldn't find a cleaner way to customize this).

Install Pastebot

I purchased this from the Mac App Store, so it might be accessible on other devices for free in the future.

Use the hotkey Ctrl + Opt + V.

Execute Settings Sync: Turn On... and sign in with GitHub.

To get code to work on the command line, open VS Code and run the command "Install code command in PATH".

Configure git

  1. Generate a new SSH key: cd ~/.ssh && ssh-keygen
  2. ssh-add ~/.ssh/id_rsa
  3. Copy the id_rsa.pub contents to my GitHub profile
  4. git config --global user.name "Ben Lind"
  5. git config --global user.name "$email"
  6. git config --global pull.rebase true (rebase when pulling by default instead of creating merge commits)
  7. git config --global push.autoSetupRemote true (no need for git push -u origin $branch anymore)

Install Homebrew

Download and install the .pkg Mac installer.

Give Homebrew precedence in your PATH via .zshrc:

export PATH="/opt/homebrew/bin:$PATH"

If you get this warning on zsh startup:

compinit:503: no such file or directory: /usr/local/share/zsh/site-functions/_brew

Run brew doctor to clean it up.

If you get Insecure completion-dependent directories detected from oh-my-zsh, see the shell setup README.

Install homebrew git, zsh, and bash

These already comes with Mac, but they are slightly older versions and it's nice to be able to update manually.

brew install git zsh bash

Install trash for safe rm-ing

brew install trash

My ~/.shell/aliases already has an alias for this.

Install delta for better git diffs

https://dandavison.github.io/delta/get-started.html

Install Stay

Stay is a window manager that helps with multi-display setups. It will rearrange your open windows according to a config file whenever you connect or disconnect an external monitor.

Install Rectangle

Set up the "almost maximize" configuration:

defaults write com.knollsoft.Rectangle almostMaximizeHeight -float 1
defaults write com.knollsoft.Rectangle almostMaximizeWidth -float 0.8

Should be able to export/import the rest of the configs from another computer.

Keyboard shortcuts:

  • Left Half: ⌥⌘←
  • Right Half: ⌥⌘→
  • Center Half: ⌥⌘↓
  • Maximize: ⌥⇧⌘F
  • Almost Maximize: ⌥⌘↑
  • Maximize Height: ⌃⌥⇧↑
  • Center: ⌥⇧⌘C
  • Next Display: ⌥⇧⌘→
  • Previous Display: ⌥⇧⌘←

I used to use Spectacle but it was abandoned sometime before Sep 2021.

Install ack

brew install ack

Install Alfred

  • Disable the Spotlight Cmd + Space shortcut by going to the Spotlight pref pane, clicking Keyboard Shortcuts, and unchecking any associated shortcuts.
  • Ignore commas in math by going to Features > Calculator and checking "Ignore thousands grouping separator"

Set up System Settings keyboard shortcuts

In System Preferences > Keyboard > Keyboard Shortcuts... > App Shortcuts, add the following items:

App Menu Item Shortcut Notes
Mail Insert Bulleted List ⇧⌘8
Add... ⌘K
Save Attachments... ⇧⌘S
Send ⌘⏎
Mailbox Search ⌘F
Find... ⌥⌘F
Mail Help ⇧˄⌘/ So that Cmd + Shift + / opens the menu search instead of launching Help
Spotify Private Session ⌘P
Preview Adjust Size... ⌥⌘I
Google Chrome Bookmark This Tab... ⇧⌘D
Calendar Show Calendar List ⌘B
Hide Calendar List ⌘B
By Day ⌥⌘1
By Week ⌥⌘2
By Month ⌥⌘3
By Year ⌥⌘4
Webex Start or stop video on a call ⇧⌘V
Mute or Unmute Yourself ⇧⌘A
ChatGPT Toggle Sidebar ⌘B
iTerm Screen ⇧˄⌥⌘P So that an accidental ⌘P doesn't trigger Print

Then under Mission Control, enable the Show Notification Center toggle and assign it the shortcut: ⇧⌥⌘N

Set up desktop wallpapers

These are stored in iCloud Drive > Desktop Wallpapers. Download them and have each display randomly cycle through them.

Configure screenshots

Save to ~/Downloads:

defaults write com.apple.screencapture location ~/Downloads

Don't show the floating thumbnail (which delays the screenshot actually showing up in ~/Downloads by a few seconds) by hitting Cmd + Shift + 5, clicking Options, and un-checking the floating thumbnail option.

Install other apps:

  • Backblaze
  • Dropbox (for org files)
  • Obsidian
    • Add a custom icon (iCloud Drive > obsidian icons)
  • Glance
  • Aliento (for closing notifications with a keyboard shortcut—use ⌘⌥⇧K)

Install Chrome extensions

These should be auto-installed via the browser's sync process.

  • uBlock Origin Lite
  • tabToWindow for moving tabs between windows. Change the "next window" keybinding to Cmd + Shift + S, and remove every other keyboard shortcut.
  • Tampermonkey (Chrome & Firefox). Set up settings sync to sync your scripts to Google Drive (I set this up for work but not yet for personal).
  • Stylus (Chrome & Firefox). Set up settings sync to sync your scripts to Google Drive (I set this up for work but not yet for personal).

Vimium (Chrome) or Vimium-FF (Firefox)

Use these custom key mappings:

# Insert your preferred key mappings here.

# On Mac, "alt-p" actually maps to the pi character
map <a-π> togglePinTab

unmap W
unmap p
unmap P
map <c-f> LinkHints.activateModeToOpenInNewForegroundTab

# Unmap commands that I often accidentally hit
unmap p
unmap `

Set up sudo to use Touch ID

https://apple.stackexchange.com/questions/259093/can-touch-id-on-mac-authenticate-sudo-in-terminal

Install nvm

Install node

nvm install --lts

That should set the LTS version up as the default for you.

Update npm

nvm install-latest-npm

Install yarn

npm install --global yarn

Hide Desktop icons

defaults write com.apple.finder CreateDesktop false && killall Finder

If that fails with Could not write domain com.apple.finder; exiting, then:

su blind-admin
sudo chown -R blind:staff /Users/blind/Library/Preferences/com.apple.finder.plist

Set up SMS text message forwarding from iPhone

Unless you do this, you will only be able to see/send iMessages from the Mac Messages app.

On your iPhone, go go Settings > Messages > Text Message Forwarding. Toggle the new computer on.

Hush the terminal's "last login" message

touch ~/.hushlogin

Remove the incessant MacOS 15 "app is accessing your screen" warnings

Install https://github.com/luckman212/screencapture-nag-remover

Backing up a Computer

Here are some things you should make sure to back up before wiping a hard drive:

  • TamperMonkey scripts
  • Stylus styles
  • Home directory dotfiles (e.g., ~/.shell/work)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment