Page History

macOS miscellanea

Nigel Stanger edited this page 11 hours ago

Clone this wiki locally

Useful keyboard shortcuts

Lots of other good ones here:

To get a list of all user-defined keyboard shortcuts: defaults find NSUserKeyEquivalents In the results, @ = command, ~ = option, ^ = control, $ = shift.


Spotlight status: sudo mdutil -a -s or mdutil -s mountPoint

Rebuild all indexes: sudo mdutil -avE

Enable/disable indexing of a volume: mdutil -i on|off mountPoint


  • Anonymous AFP URLs: afp://;AUTH=No%20User%20Authent@mac-support/mac-support
  • Disable application resume per application: defaults write com.[vendor].[AppName] ApplePersistenceIgnoreState YES (e.g., defaults write com.Apple.Preview ApplePersistenceIgnoreState YES).
  • Create an internet location file to a mounted server (AppleScript):
    tell application "Finder" to make new internet location file at desktop to "smb://" with properties {name:"Staff Desktop Profile"}
  • Change HFS attributes on an entire directory tree: find . -exec setfile … {} \;. See man page for SetFile (case-sensitive!).
  • MagicPrefs emulates the mouse, which prevents you from clicking on the “Allow…” button in the Security preference pane. Temporarily disabling MagicPrefs fixes this (see In fact, this appears to apply to any button that involves a trust setting (e.g., when installing non-gallery Safari extensions).
  • Restart a borked internal camera: sudo killall VDCAssistant.
  • When exporting a Keynote presentation as a QuickTime movie for uploading to the web, the following settings are a reasonable compromise between quality and file size: don’t automatically open in full screen, H.264, 24 fps, key frame every 48 frames, quality slider halfway between medium & high.
  • sudo postfix start will start the mail system, as it has a tendency to switch itself off. Typical symptom:
    % mailq
    postqueue: fatal: Queue report unavailable - mail system is down
    To delete the contents of the queue:
    mailq | awk '$7~/@/{print$1}' | while read qid; do sudo postsuper -d $qid; done

Create a RAM disk


diskutil erasevolume HFS+ 'RAMDiskName' `hdiutil attach -nomount ram://XXXXXX`

where XXXXXX is a count of 512-byte blocks (e.g., 262114 for a 128MB RAM disk). Disk will be mounted at /Volumes/RAMDiskName/.

Fixing slow launch of Mail

This is kind of the “nuke it from orbit approach” as it has to re-import all the messages from 365 and a bunch of settings will be reset, but it does fix the slow launch problem.

Hmm, watch out for the DataVaults folder under Library/Containers/ in Catalina. It’s protected by SIP and only deletable via the Terminal in recovery (nice job, Apple). Need to mount the volume via Disk Utility first if it’s encrypted (always?).

Create macOS guest in VirtualBox

  1. Install Bash ≥ 4.3 or zsh ≥ 5.5 if needed.
  2. Clone macos-virtualbox from
  3. Configure the script as necessary (note: minimum disk image size for installing Catalina is 25GB).
  4. /opt/local/bin/bash -i
  5. Once the install is done, shut down the VM and change the default resolution, e.g. (
    /Applications/VirtualBox/Contents/MacOS/VBoxManage setextradata "Catalina" VBoxInternal2/EfiGraphicsResolution 1920x1080
    where "Catalina" is the name of the VM.

Secure VNC/remote desktop

See for how to remote access a Mac without unlocking the local display. Short version:

  • VNC in.
  • Fast user switch to another account.
  • Lock screen.
  • Disconnect and reconnect.
  • You will be asked which display to use.