Skip to content

Instantly share code, notes, and snippets.

@devnoname120
Last active June 8, 2024 14:27
Show Gist options
  • Save devnoname120/4767a0aa18879217170fd0c68809fc24 to your computer and use it in GitHub Desktop.
Save devnoname120/4767a0aa18879217170fd0c68809fc24 to your computer and use it in GitHub Desktop.
My macOS setup

ℹ️ Enable iCloud end-to-end encryption:

  • Nobody knows that, but iCloud actually supports end-to-end encryption (see “Advanced Data Protection for iCloud”) but it's disabled by default. If you care about data privacy, you should turn it on.
    • System settingsApple IDiCloud → Set Advanced Data Protection to On.
    • System settingsApple IDiCloud → Disable Access iCloud Data on the Web.
  • It supports almost all the native Apple apps, with the notable exceptions of iCloud Mail, Contacts, and Calendars. See official data protection matrix for more info.

Quality of life improvements

Mouse:

  • UnnaturalScrollWheels: Remove macOS's stupid mouse scroll/tracking acceleration. Configure as described here.
  • System Preferences → Set Tracking speed to max.
  • System Preferences → Set Scroll speed to max.

Keyboard:

  • Fix slow initial key repeat (great for arrow keys)
    • defaults write -g InitialKeyRepeat -int 10
  • Fix slow key repeat (also great for arrow keys)
    • defaults write -g KeyRepeat -int 1

Displays:

  • 🔥 BetterDisplay ($22 for pro): Custom resolutions, smooth fractional HiDPI scaling (e.g. for 2.5k screens), virtual screens, picture-in-picture displays, HDR brightness, screen control over DDC.
  • Lunar: Control the brightness of external screens via DDC (over HDMI/DP/DP USB-C/TB2&3/VGA/DVI). You can define different contrast and brightness curve for each screen to make them match visually. ⚠️ If you use an adapter or a USB-C cable, it needs to forward DDC messages correctly (if it supports DP over USB-C it should be fine).

Windows:

  • Drag a window by pressing Control ⌃ Commmand ⌘ + click anywhere in the window
    defaults write -g NSWindowShouldDragOnGesture -bool true
    • This is a huge quality of life improvement!!
  • Make file proxy appear immediately (the little icon in the toolbar inside a window that you can drag to move the open file elsewhere)
    defaults write NSGlobalDomain "NSToolbarTitleViewRolloverDelay" -float "0"
  • yabai: Stunning tiling window manager that makes you super productive. Must have.
    • It's a bit hard to configure though, no sane defaults.
    • Use Übersicht or SketchyBar for a status bar that shows the list of spaces, the current one, etc.
    • ⚠️ Some features require to disable System Integrity Protection and then configure the scripting addition
      echo "$(whoami) ALL=(root) NOPASSWD: sha256:$(shasum -a 256 $(\which yabai) | cut -d " " -f 1) $(\which yabai) --load-sa"
      
      sudo visudo -f /private/etc/sudoers.d/yabai
    • This has to be done after each yabai update
  • Don't automatically switch spaces when clicking on the dock.
    defaults write com.apple.dock workspaces-auto-swoosh -bool NO
  • System PreferencesMission Control → Untick When switching to an application, switch to a Space with open windows for the application.
  • AltTab: Replace the built-in window-switching shortcut Commmand ⌘ Tab ⇥ to add previews, hide windows from other spaces, close windows with Control ⌃ w and Control ⌃ q, etc.
    • Update: don't combine it with yabai or you will have a system freeze every few hours
  • Magnet ($7.99): Basic Windows-like window snapping to screen edges (+ shortcuts). No animations for snapping. Note that BetterTouchTool also embed this feature.

Sound:

  • Auto-mute output audio devices (except Bluetooth) when Mac wakes from sleep. Avoids blasting loud sound when you open your Macbook in public transport. Using Hammerspoon:
    • brew install hammerspoon
    • Download SpoonInstall and unzip it to ~/.hammerspoon/Spoons/
    • Create ~/.hammerspoon/Spoons/init.lua with the following content and then reload Hammerspoon's configuration:
hs.loadSpoon("SpoonInstall")

spoon.SpoonInstall.repos.devnoname120 = {
    url = "https://github.com/devnoname120/hammerspoon-collection",
    branch = "build",
}

spoon.SpoonInstall:andUse("AutoMuteOnSleep", {repo="devnoname120", start=true})

Bluetooth:

  • Bluesnooze: Automatically switch off Bluetooth when macOS goes to sleep. This prevents it from connecting to e.g. Bluetooth headphones in its sleep, which can prevent your phone from connecting if no (or too limited) multipoint. Super irritating.
    • Warning: your Bluetooth trackpads/keyboards will (obviously) not be able to wake your Mac from sleep if you enable this.
    • Instructions:
      • brew install bluesnooze
      • Open Bluesnooze.app
      • Click on the tray icon → Launch on login

Battery:

  • System PreferencesBatteryBattery → Tick Low power mode
    • ×2 my battery time, and can't notice any difference in snappiness.

Dev:

  • Using touch id for sudo authentication:
    • Run sudo cp /etc/pam.d/sudo_local{.template,}
    • Run sudo vim /etc/pam.d/sudo_local and add or uncomment this line:
      auth       sufficient     pam_tid.so
      
    • Run sudo vim /etc/pam.d/sudo Add the following line at the top if it's missing. Otherwise just close vim.
      auth       include        sudo_local
      
    • Note: if it stops working after a macOS update then do these steps again.

Finder:

  • Always display the current path at the bottom:
    • FinderSettingsShow Path bar
    • Or defaults write com.apple.finder ShowPathbar -bool true
  • Show file extensions:
    • FinderSettings…AdvancedShow all filename extensions
  • Show useful folders in the sidebar:
    • FinderSettings…Sidebar → tick <home folder> which has a house 🏠 symbol
  • Don't keep open previously previewed files
    • defaults write com.apple.Preview ApplePersistenceIgnoreState YES
  • Stop creating .DS_Store files on network storages (WebDAV, NFS, etc.) and USB devices
    • defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
    • defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true

System Settings:

  • Disable notifications when screensharing
    • Notifications & focusNotifications → Untick When mirroring or sharing the display (at the bottom)
  • See Nikita Voloboev's macOS configuration for more settings.

⚠️ You need to log out and then log back in to apply defaults write changes.

Performances:

  • Remove macOS MRT (Apple's antivirus that hogs resources)
sudo launchctl stop com.apple.mrt
sudo launchctl remove com.apple.mrt
sudo rm -f /System/Library/Launch{Agents,Daemons}/com.apple.MRT*.plist

# This one only works if SIP is disabled
chmod -R -x+X /System/Library/CoreServices/MRT.app
  • Fix mds/mds_store/md_worker high CPU usage (Spotlight indexing)
    • System PreferencesSpotlightPrivacy → Add the following paths:
     /usr, /bin, /sbin, /opt, /private, /Library
     /System/{Library, Application Support}
     ~/.cache
     ~/Library/{Caches, Logs, Application Support, Containers, Group Containers}
    • You can find more paths to exclude in mds's logs
      • sudo fs_usage -w -f filesys mds
    • You will need to do that again at every macOS update

Bugs:

  • When Macbook Air M1 is sleeping, external screens connected via USB-C keep waking up every few minutes and then go straight to sleep again.
    • Workaround (source):
      • sudo pmset -a tcpkeepalive 0
      • sudo pmset -a powernap 0
      • Disable System PreferencesBatteryOptimized battery charging
      • Disable System PreferencesBatteryPower AdapterWake for network access
    • See the reasons of the past wakes
      • pmset -g log | grep 'due to'

Shortcuts:

  • General
    • Commmand ⌘ Option ⌥ Shift ⇧ v: Paste text without formatting
    • Commmand ⌘ Control ⌃ q: Lock screen
    • Commmand ⌘ Control ⌃ space: Open Emoji finder
    • Commmand ⌘ Shift ⇧ /: Search in the currently focused app's menus
    • See more on Apple's website.
  • Finder
    • Commmand ⌘ Option ⌥ v: Paste copied item and remove it from original location.
    • Hold Option ⌥: Reveal path breadcrumbs.
      • Right click on a breadcrumb to copy path or open in terminal.
    • Commmand ⌘ : Move to parent directory.
    • Commmand ⌘ : Open directory/file.
      • Commmand ⌘ o: Does the same thing.
    • Commmand ⌘ Shift ⇧ g: Go to path.
    • Commmand ⌘ Option ⌥ c: Copy path of highlight file/directory.
    • Commmand ⌘ Shift ⇧ .: Show hidden files.
      • Make it the default: defaults write com.apple.finder AppleShowAllFiles YES.
  • iTerm2
    • Option ⌥ click: Move cursor of the command being written at the mouse position.
    • Enable Commmand ⌘ to delete a word in the command line.
      • iTerm2Preferences...Profiles → tab KeysKey MappingsPresets...Natural Text Editing
    • See iTerm2 cheatsheet for more.
  • Other apps:

Multimedia:

  • Shottr: Free screenshot app + annotations + OCR zone of screen to clipboard. ❤️
    • [22-04-22] v1.5.2 is 100% free. Newer versions are still free but show a (rare) nag to nudge you into buying the product for $8..
  • IINA: Awesome video player with great UI on top of mpv (way better than VLC).
    • brew install iina
    • YouTube support:
      • brew install yt-dlp # better than youtube-dl
      • ln -s /opt/homebrew/bin/yt-dlp /opt/homebrew/bin/youtube-dl
      • PreferenceNetworkCustom youtube-dl path/opt/homebrew/bin/
    • More active and up-to-date fork: IINA Plus`
  • HandBrake: ffmpeg GUI that helps convert videos.

Productivity:

  • Alfred: Spotlight replacement (search, browse, clipboard history, snippets, workflows).
    • TODO: add my workflows
  • Spark: Awesome productive email client with first-class multi-inbox, archiving/snoozing/sending later emails, etc. Must-have.
  • Fantastical ($43.99/yr): Great calendar app. Event creation using natural language, first-class timezone + weather support
  • MeetingBar: Display time until next meeting in the status bar, and allow opening the meeting link directly.
  • Karabiner: Remap macOS keys.
    • 🔜 TODO share my config file.
  • Finda: Dmenu equivalent that works on everything (open windows, tabs, browser history, etc.).
  • Tracker Zapper: Watches the clipboard and automatically get rid of trackers from copied URLs (utm_source, fbclid, etc.).

UI/UX tweaks:

  • KeepingYouAwake: Prevent macOS from sleeping (temporarily).
  • Dozer: Declutter macOS menu bar by selectively hiding icons.
  • Muzzle: Disable all notifications when sharing screen.
  • Side Mirror: Show second screen (projector) in a window on the main screen. Useful for presentations
  • macOS-key-cast: Display an overlay with macOS keys you type. Useful for recording the screen with QuickTime.

Dev:

  • iTerm2: Way better Terminal than the default one.
  • Shell/zsh programs
    • Powerlevel10k: Awesome ZSH theme/plugin. Easy to customize. Works for many shells zsh (default on macOS), bash, etc.
    • mcfly: Awesome shell reverse-search-history replacement for the default clunky Control ⌃ r (aka reverse-i-search).
    • z: Track most frequently used directories and then jump to them easily.
    • SCM Breeze: Add numbered shortcuts to the output of Git, ls, etc.
    • tealdeer: superfast unofficial client for the tldr pages (official client sucks).
      • brew install tealdeer
    • ripgrep: Replacement for find. Blazing fast file search with sane defaults.
    • Zsh antidote plugin manager
      • Plugins (add in .zsh_plugins.txt):
        • Extra command auto-completions: zsh-users/zsh-completions
        • Fish-like grey autosuggestions: zsh-users/zsh-autosuggestions
        • Syntax highlight for shell commands: zsh-users/zsh-syntax-highlighting
    • ncdu: visualize disk usage tree to find big files
  • Syntax Highlight: Preview source code files with syntax highlighting in Finder's Quick Look (opened when pressing space on a file).
  • TextMate: Fast & lean text editor with syntax highlighting. I use it to do quick file edits like I would in the terminal with Vim.
  • OpenInTerminal: Open the current Finder folder in a terminal.
  • DevUtils ($30/device): hacker toolbox. Convert unix timestamps, base64 decode, URI decode, JSON beautifier, test RegExes, etc.
    • See DevToysMac for a free alternative
    • See CyberChef for an offline webapp alternative
    • See DevBox for a webapp-based alternative (free on the website, app is paid)
  • Vnc connect: free VNC client that just works.

Backups:

Privacy:

Running Windows apps

  • Parallels Desktop — Awesome seamless integration of Windows apps in native macOS Windows. Perfect bidirectional integration (can right-click —> open with macOS apps from Windows and vice versa).
    • hyperenable — Disable Windows 11 intempestive Office popups that show up when pressing ctrl-shift-alt-win (I already use this combination as a hyper key on macOS)

To be reviewed

More macOS defaults configurations: https://gist.github.com/vraravam/5e28ca1720c9dddacdc0e6db61e093fe

  • Amethyst: xmonad-like tiling window manager
  • Bartender ($20): Menu bar customization + command palette for all menus and icons
  • Proxyman: HTTP mitm debugging tool (like Charles Proxy and Fiddler)
    • mitmproxy may be a better option
  • RapidAPI: HTTP sandbox to test and create API

Hammerspoon:

  • Script for Windows snapping like Spectacle/Rectangle

⚠️ Requires system integrity protection to be disabled.

Dev:

  • redo: interactively create shell function from shell history.
  • alacritty: super fast OpenGL terminal emulator
  • zsh surround plugin: surround command with parenthesis/bracket/etc. for easier editing
  • zsh select-quoted plugin: select the text under the cursor to outer delimiter boundaries (e.g. "…", '…', etc.)
  • zsh select-bracketed plugin: same but with matching parentheses/brackets so that it works for nested parentheses/brackets
  • zsh autopair plugin: auto-close parenthesis/brackets/etc.
    • ❗ I'm not sure if it does it live (good) or once the command is run (bad)
  • ctop: top equivalent but for docker
  • ktop: top equivalent but for kubernetes

Multimedia:

  • SoundSource: Fine-grained by-app sound control for Mac + precise audio EQ

Productivity:

  • Typinator: auto-expand user-defined abbreviations.
  • Keyboard Maestro: Automate tasks, create macros.
  • Responsively: Test a website on many device screen sizes at once.
  • Paw: Test REST APIs (Postman alternative).
  • Hook: Create local perma-links to anywhere in any documents. Useful for cross-referencing stuff (+ use those links in Obsidian).
  • Timing: App-usage time tracking, miles ahead of Apple's native feature
  • Presentify: Annotate your screen while sharing it or presenting it to an audience.
  • numi ($22): Calculator app in natural language
  • Prizmo (80€): advanced OCR processing for documents (OCR, table detection, edge repair, resampling, resolution upscaling)
  • MarginNote ($47): annotate books and documents
  • CheatSheet: Show cheatsheet of all the shortcuts of the current app

Utilities:

  • Better Mouse ($8): super powerful tool to configure mouse (e.g. Logitech Master MX 3) features such as ratchet/break point, DPI, bindings, etc. It's not mouse-agnostic but instead supports the specific
  • SteerMouse ($20): similar to Better Mouse
  • Day One App: Journaling app. Claims to be e2e encrypted and to protect users' privacy.
  • rcmd: Switch to apps directly using a option+letter shortcut. ⚠️ Conflicts with qwerty-fr.
  • PDF viewer/annotator
  • espanso: Auto-expanding inline snippets with templating support.
  • sloth: GUI that shows open ports/files/more for each running app
  • peek ($7.99): awesome QuickLook plugin that supports a lot of file types

Multimedia:

  • LosslessCut: The swiss army knife of lossless video/audio editing

Tested but didn't like

Annoyances:

  • Mac Mouse Fix: Remove accelerated scroll, and general improvement fixes.
    • 🙅‍♂️ Couldn't remove mouse acceleration, lacked other options I needed.
  • MonitorControl: Alternative to Lunar
    • 🙅‍♂️ Tried but randomly prevented brightness keys from working when coming back from sleep.
  • XtraFinder: Finder improvements. Dual panels, copy paths, make symbolic links, always show folders on top of file lists.
    • 🙅‍♂️ Not bad but too bloated/too many features for me. I rarely needed any of the added features.
  • Rectangle: Alternative to Magnet. Windows-like resizing snapping edges.
    • 🙅‍♂️ Sometimes windows don't return to their original size, and features randomly behave erratically.
    • 🙅‍♂️ I suspect that the author keeps these bugs on purpose to promote their paid product (Hookshot aka Rectangle Pro).
  • defaults write -g com.apple.mouse.scaling -1
    • 🙅‍♂️ Doesn't seem to work anymore as of macOS 12 (Monterey). Use UnnaturalScrollWheels instead.
@devnoname120
Copy link
Author

devnoname120 commented Apr 6, 2022

Images:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment