Page History

macOS miscellanea

Nigel Stanger edited this page on 28 Nov

Clone this wiki locally

Useful keyboard shortcuts

Lots of other good ones here: http://apple.stackexchange.com/questions/400/please-share-your-hidden-os-x-features-or-tips-and-tricks/

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

Spotlight

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

Miscellaneous

  • 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://registry.otago.ac.nz/mdr/Profiles/staff3/s/7/stani07p" 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 https://discussions.apple.com/thread/8087342). 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.

Create a RAM disk

From https://stackoverflow.com/a/23359182.

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.

https://appletoolbox.com/mail-not-working-after-macos-mojave-upgrade-how-to-fix/#Mail_Crashing_or_Slow_After_macOS_Mojave_Upgrade_How-To_Fix

Hmm, watch out for the DataVaults folder under Library/Containers/com.apple.mail/Data 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 https://github.com/myspaghetti/macos-virtualbox.
  3. Configure the script as necessary (note: minimum disk image size for installing Catalina is 25GB).
  4. /opt/local/bin/bash -i macos-guest-virtualbox.sh
  5. Once the install is done, shut down the VM and change the default resolution, e.g. (https://scribles.net/changing-screen-resolution-of-mac-os-virtualbox-guest/):
    /Applications/VirtualBox/Contents/MacOS/VBoxManage setextradata "Catalina" VBoxInternal2/EfiGraphicsResolution 1920x1080
    where "Catalina" is the name of the VM.

Secure VNC/remote desktop

See https://apple.stackexchange.com/a/343989 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.