Encrypted Disk Images

  • Start Disk Utility
  • Choose File -> New Image -> Blank Image
  • Pick a maximum Size - take care with this, as your disk image won’t be able to grow larger than the value you set
  • Format should be APFS (Case-sensitive) unless you’re running a spinning disk drive, in which case pick Mac OS Extended (Case-sensitive, Journaled)
  • Encryption should be 256-bit AES unless that’s too slow for you
  • Image Format should be either sparse bundle disk image or sparse disk image.
    • Use sparse disk image if you want to create a single, large, encrypted file
    • Use sparse bundle disk image if you want to create a lot of smaller, encrypted files - useful if you want to sync this image using something like OneDrive/Dropbox/whatever.

– via Apple Support and Eclectic Light Company

Format external drive as APFS

Issue: When trying to reformat a drive in Disk Utility, APFS is missing from the formats list, with only Mac OS Extended, MS-DOS and ExFAT present. Solution: View -> Show All Devices. Then, select the disk (and not the volume) you want to format, pick the GUID Partition Map scheme, and you’ll find that APFS becomes available.

Check DNS caching duration for a domain

Run dig TYPE <domain> in a console, and make note of the number to the left of IN - that’s the cache duration, in seconds.

– via Ciberciti

Flush DNS cache

sudo dscacheutil -flushcache
sudo killall -HUP mDNSResponder

– via Mackeeper Blog

Fix that 🤬 issue when I can’t type anything and I can’t focus any apps either

It seems to appear when I have an OS update pending. Rebooting doesn’t work, even when long pressing the power button. Here’s what worked:

  1. Open Finder
  2. Use that to open Activity Monitor
  3. Notice that I can’t focus on anything
  4. It may help to also start iTerm2? Not sure
  5. Quit Activity Monitor
  6. Start it again.
  7. Notice I can focus on things
  8. Kill mds_stores
  9. Kill another update process, can’t remember the name
  10. That seemed to work last time.

Automatically eject external drives when Mac goes to sleep

I’ve used BetterTouchTool to schedule an action to run Before Mac Goes To Sleep. It’s running an Execute Shell Script / Task with the following content:

VOLUME_ID=$(diskutil info "$VOLUME_NAME" | grep 'Device Node:' | awk '{print $3}')

if [ ! -z "$VOLUME_ID" ]; then
   diskutil eject "$VOLUME_ID"
   echo "Successfully ejected $VOLUME_NAME"
   echo "Drive not found: $VOLUME_NAME"

– some info via Stack Exchange and Folivora Community

Check swap file size and memory usage

sysctl vm.swapusage



Never trust that it will upload any file you put in the iCloud folder(s). It will silently fail to upload some files, and you’ll only notice when you try to access them from another device, which is always fun. Verify that the files are actually uploaded.

If you notice it’s not uploading files, kill the bird process, and it will restart and start uploading again. Hopefully.

Once again, never trust the thing to upload files you need on other devices.


Disable Narrow Tabs in Safari 14

  1. Make sure you have enabled website icons, via Preferences -> Tabs -> Show website icons in tabs
  2. Quit Safari
  3. Allow Full Disk Access for Terminal, via System Preferences -> Security & Privacy -> Privacy -> Full Disk Access
  4. Open Terminal and run defaults write com.apple.Safari IncludeInternalDebugMenu 1
  5. Start Safari
  6. Open the new Debug menu and unselect Debug -> Tab Features -> Narrow Tabs
  7. Enjoy the old, sane tab behavior
  8. (Optional) You can disable the menu afterwards by running defaults write com.apple.Safari IncludeInternalDebugMenu 0 in Terminal.
  9. (Recommended) Remove Full Disk Access for Terminal via System Preferences -> Security & Privacy -> Privacy -> Full Disk Access

– via Reddit and Yuriy Shiryaev

Unarchive a Safari webarchive file

Use textutil.

textutil -convert html <filename>

– via Apple StackExchange

Whitelist a site in any Safari content blocker

Look for the site in Safari -> Preferences -> Websites -> Content Blockers, set content blocking to Off

– via Reddit

Disable Cmd+Q for Safari

System Preferences > Keyboard > Shortcuts > App Shortcuts > Add one for Safari, with menu title Stop and shortcut Cmd+Q


Display shared Google calendars in Calendar.app

Select the calendars to sync here.

– via Stack Overflow

Refresh Exchange calendars not syncing with Calendar.app in Monterey

Temporarily fixes Calendar.app not showing new events from Exchange calendars in MacOS Monterey (including v12.6.1).

launchctl stop com.apple.CalendarAgent
launchctl start com.apple.CalendarAgent

The issue will come back after a while, but you can run the commands again to refresh the calendars. Alternatively, you can schedule them to run every hour or so with a cron job.

# Let's just not use vi shall we?
export VISUAL=/usr/bin/nano 

# Edit crontab
crontab -e

# Add the following line
0 * * * * launchctl stop com.apple.CalendarAgent && launchctl start com.apple.CalendarAgent

– via Apple Community


Alfred cheatsheet


  • Add the file/folder to System Preferences -> Spotlight -> Privacy and rebuild Alfred’s cache
  • Add alfred:ignore to the Spotlight comments of the file/folder to ignore

Little Snitch

Little Snitch Blocklists


ImageMagick Commands

Convert pngs or heics to jpegs.

# Convert png to jpg, with 95% quality, while stripping any metadata
convert -strip -quality 95% <source>.png <destination>.jpg

# Convert HEIC to jpg, with 99% quality
mogrify -quality 99 -format jpg IMG_8672.HEIC
mogrify -quality 99 -format jpg *.HEIC


Install ffmpeg with libvpx-vp9 support (for webm conversion)

Commands such as brew install ffmpeg --with-libvpx don’t work anymore, I’ve found that simply installing libvpx with Homebrew and then reinstalling ffmpeg will work.

brew install libvpx
brew uninstall ffmpeg
brew install ffmpeg

# Check available encoders
ffmpeg -encoders

Some info here too.

Convert gifs to mp4/webm

ffmpeg -i my-animation.gif my-animation.mp4

ffmpeg -i my-animation.gif -c vp9 -b:v 0 -crf 41 my-animation.webm

– via Google Developers

libmbedcrypto errors

Such as dyld[67892]: Library not loaded: /opt/homebrew/opt/mbedtls/lib/libmbedcrypto.

Fixed them with

brew uninstall librist --ignore-dependencies
brew uninstall mbedtls --ignore-dependencies
brew reinstall ffmpeg

– via Stack Overflow


Download videos from YouTube using yt-dlp

yt-dlp <url> -S ext:mp4:m4a

# bestest everything
yt-dlp <url> -f "bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best"

– via this GitHubIssue


Detect and remove externally added extensions

Like this unsolicited/unconfirmed, spyware-like extension that Adobe Acrobat Reader installs without your consent and which you should totally remove and report.

# this is where the external extensions are stored
cd /Users/<user>/Library/Application Support/Google/Chrome/External Extensions

# list the extensions
ls -l

# in my case, there was only efaidnbmnnnibpcajpcglclefindmkaj.json
cat efaidnbmnnnibpcajpcglclefindmkaj.json
> {
>     "external_update_url": "https://clients2.google.com/service/update2/crx"
> }

# kill it with fire, then restart Chrome
rm efaidnbmnnnibpcajpcglclefindmkaj.json

– via Dan’s comment to my LinkedIn post

Find and kill processes listening to ports

# get a list of processes that are listening to ports
sudo lsof -iTCP -sTCP:LISTEN -n -P

# and, you know..
sudo kill -9 <PID>

– via StackOverflow

Copy some text and/or file contents to clipboard

Use pbcopy (there’s also pbpaste!).

pbcopy < ~/.ssh/id_rsa.pub

– via StackOverflow

Stop apps from running automatically on startup

  1. Settings -> General -> Login Items, but you’ve tried this already
  2. /Library/LaunchAgents
  3. /Library/LaunchDaemons
  4. /Users/<you>/Library/LaunchAgents
  5. /Users/<you>/Library/LaunchDaemons

Don’t touch /System/Library/LaunchAgents and /System/Library/LaunchDaemons though.

Check running processes with launchctl list

– via MacWorld