Table of Contents

Encrypted Disk Images

– via Apple Support and Eclectic Light Company

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

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 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 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

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

Download one or more files to your local machine via SSH

Use scp.

# Download single file
local> scp local/path 

# Download directory recursively
local> scp -r local/path 

– via Stack Overflow

Create a script that runs over SSH

Basic script

ssh <your-server> << EOF
    echo "Hello world"
    echo "This is where your script should be"

– via Amit Chaudhary

Displaying the ssh command outputs and avoiding the “Pseudo-terminal will not be allocated because stdin is not a terminal." warning

ssh <your-server> -tt << EOF
    echo "Hello world"
    echo "This is where your script should be"

– via Stack Overflow

Bonus: Setting up a ssh key for passwordless auth

ssh-keygen -t rsa -b 2048

ssh-copy-id id@server -i <path_to_your_new_key>

ssh id@server  -i <path_to_your_new_key>

I’m including the path to the new key since I’m using a dedicated, passwordless key for this specific instance. If you’re just setting up the default key (~/.ssh/id_rsa) then you won’t need the -i option.

– via Stack Overflow

Alfred cheatsheet

iTerm: remove the right arrow to the left of the prompt

It’s the Marks feature. Disable it from Preferences -> Profiles -> <your profile> -> Terminal -> Shell integration -> Show mark indicators -> Off

– via Stack Overflow

iTerm useful shortcuts

Whitelist a site in any Safari content blocker

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

Display shared Google calendars in

Select the calendars to sync here -

– via Stack Overflow

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

Refresh Exchange calendars not syncing with in Monterey

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

launchctl stop
launchctl start

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 && launchctl start

– via Apple Community