Table of Contents

macOS specific commands

Miscellaneous

Remove application from quarantine

sudo xattr -rd com.apple.quarantine Aurora\ HDR\ 2017.app

Switch Xcode target

This might be necessary after installing an Xcode or macOS beta.
sudo xcode-select --switch /Application/Xcode-beta.app

Turn Off Dark Mode for specific app

  1. Find out app identifier
    osascript -e 'id of app “Subtitle Edit”'
  2. defaults write AppIdentifier NSRequiresAquaSystemAppearance -bool Yes

Hide and unhide files

Hiding a file

chflags hidden ../BasiliskII_Prefs

Unhiding a file

chflags nohidden ../BasiliskII_Prefs

Show hidden files in Finder

defaults write com.apple.finder AppleShowAllFiles YES

Hostname lookup for Bonjour/Zeroconf

dns-sd -Gv4v6 $BONJOURNAME

Unregister application's URI scheme

  1. Check for registered applications, e.g.
    /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -dump | grep Transmission
  2. Unregister
    /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -R -f -u /Applications/Transmission.app

System software updates

Install all available updates

sudo softwareupdate -ia

Install latest macOS Installer

sudo softwareupdate --fetch-full-installer [--full-installer-version 10.15]

Create physical installatino media

sudo /Applications/Install\ macOS\ Catalina.app/Contents/Resources/createinstallmedia --volume /Volumes/MyVolume

Ignore a particular update

sudo softwareupdate --ignore "macOS Catalina"

Mount volumes via SSH/SFTP

  1. Create a mountpoint anywhere
    mkdir /tmp/manuals
  2. Mount it
    sshfs -o follow_symlinks,volname=Manuals john:/yoko/manuals /tmp/manuals

Networking

Show open ports

lsof -nP +c 15 | grep LISTEN

Printing

Show detailed information about (CUPS) printers

Method 1
  1. cupsctl WebInterface=yes
Method 2
  1. Check for DeviceURI lines in /etc/cups/printers.conf

Change existing printer's address

  1. cupsctl WebInterface=yes
  2. Open http://localhost:631/printers in your web browser
  3. Click on the printer you want to change. From the Administration drop down, select Modify Printer.
  4. Log in with your local admin account
  5. Select the new printer IP either from “Discovered Network Printers” or add it manually with Other Network Printers. Make sure that you keep the same connection protocol as it says in Current Connection.

Spotlight

Missing results, missing applications

Did you try turning it off and on again?

  1. sudo mdutil -a -i off
  2. sudo mdutil -a -i on

Finder

Enable "Quit Finder" in menu

defaults write com.apple.finder QuitMenuItem -bool true; killall Finder

QuickLook only shows icons instead of actual previews (Monterey)

1. Restart Finder :/