The best OS a parents' money can buy

Wednesday, Jun 17, 2020

Mac OS

Useful Shortcuts

If you find these hard to remember, there’s a useful application called CheatSheet that you can use:

brew cask install cheatsheet

After it’s installed, you can hold ⌘ and the list of keyboard shortcuts for the current application will appear.

Shortcut Function
⌘ ⇧ [ Switch to previous tab
⌘ ⇧ ] Switch to next tab
⌘ [ Go back to previous page
⌘ ] Go forward to next page
⌘ ` Cycle through open windows of current app
⌘ [tab] Cycle through open apps
⌃ ↓ View all open windows of current app
⌃ ↑ View all open windows of every app

Sleep, Restart, Shut Down, Log Out

Shorcut Function
⌥ ⌘ ⏏︎ Sleep
⌃ ⌘ Q Lock Screen
⌃ ⌘ ⏏︎ Restart
⌃ ⌥ ⌘ ⏏︎ Shut down
⌥ ⇧ ⌘ Q Log out

Document Editing

These work when editing text using Safari, Notes, and Mail, and any Mac OS application in general. They aren’t arbitrary, they’re the emacs hotkeys, and work on many applications, not just ones on Mac OS.

Shortcut Function
⌃ A Move to the beginning of the line
⌃ E Move to the end of the line
⌃ H Delete the character left of the the cursor
⌃ D Delete the character right of the cursor
⌃ U Delete all text left of the cursor
⌃ K Delete all text right of the cursor
⌃ O Add a newline without moving the cursor
⌃ T Swap the characters left and right of the cursor

Cursor Movement

If you’re ever stuck without arrow keys (it could happen!) you can take advantage of these 4 shortcuts.

Shortcut Function
⌃ F Move cursor →
⌃ B Move cursor ←
⌃ P Move cursor ↑
⌃ N Move cursor ↓

Tip: These look arbitrary, but they use a helpful pneumonic, hidden as it may be. Forward, Backward, Previous, Next.


Shortcut Function
⌘ , Open preferences window
⌘ ⇧ / Open help menu for current app
⌘ ⌃ F Open app in full-screen
⌥ ⌘ I Open inspect element

Tip: You can open inspect element in many more apps than you think. Give it a try!


Shortcut Function
⌘ ⌫ Send file to trash
⌥ ⌘ ⌫ Completely delete a file
⌥ ⌘ ⇧ ⌫ Empty the trash
⌘ ⇧ N Create a new folder
⌥ ⌘ V Transfer copied file/folder to the current folder
⌘ ⇧ . Show hidden files/folders
⌘ E Eject selected disk/drive
Shortcut Function
⌘ ↑ Open the parent folder
⌘ ↓ Open the file/folder
⌘ → Open the folder (list view)
⌘ ← Close the folder (list view)

Opening Folders

Shortcut Function
⌘ ⇧ G Go to folder
⌘ ⇧ D Open the Desktop folder
⌘ ⇧ O Open the Documents folder
⌥ ⌘ L Open the Downloads folder
⌘ ⇧ H Open the Home folder
⌘ ⇧ A Open the Applications folder
⌘ ⇧ R Open the AirDrop folder
⌘ ⇧ I Open the iCloud folder

Adjusting the Finder Window

Shortcut Function
⌘ ⌥ P Show/hide the path bar
⌘ ⌥ S Show/hide the side bar
⌘ ⌥ T Show/hide the toolbar
⌘ ⇧ T Show/hide the tab bar
⌘ / Show/hide the status bar
⌘ ⇧ P Show/hide preview of selected file
⌘ 1 View folder’s items as icons
⌘ 2 View folder’s items as list
⌘ 3 View folder’s items as columns
⌥ ⌘ ⌃ 1 Sort files by name
⌥ ⌘ ⌃ 2 Sort files by type
⌥ ⌘ ⌃ 4 Sort by date added
⌥ ⌘ ⌃ 5 Sort by date modified


Shortcut Function
⌘ ⇧ \ Show all tabs
⌘ L Select the current page’s URL
⌘ ⇧ R Open in reader-view
⌘ ⇧ I Mail link of current page
⌥ [click] Download linked file
⌘ [click] Open link in a new tab
⌘ D Add current page to bookmarks
⌘ ⇧ D Add current page to reading list
⌥ ⌘ L Open the downloads folder
⌥ ⌘ E Reset the cache
⌘ ⇧ C Start/stop select element
⌥ ⌘ C Open JavaScript Console
⌥ ⌘ I Open/close inspect element (also closes JavaScript console)
⌥ ⌘ R Hard refresh page


Shortcut Function
⌘ ⇧ N Get new messages
⌘ N Write new message
⌥ ⌘ F Search mail for message
⌘ ⇧ D Send message
⌥ ⌘ J Empty junk mailbox
⌘ ⇧ ⌫ Empty trash mailbox
⌘ 1 View inbox
⌘ 2 View drafts
⌘ 3 View sent
⌘ 4 View junk
⌘ 5 View trash


Shortcut Function
⌥ ⌘ D Show/Hide the dock

Tip: You can add the control character to your usual screenshot command, to have screenshots save directly to your clipboard.

Change screenshot capture type

By default, screenshots save to .png but you can change this setting to .jpg or .pdf

Set default screen capture as .jpg

defaults write type -string 'jpg'
killall SystemUIServer

Change screenshot capture location

By default, screenshots save to ~/Desktop. I prefer them to be saved to ~/Downloads. You can change the screenshot capture location by running this command.

defaults write location /Users/austin/Downloads && killall SystemUIServer

Warning: I had a little bit of trouble with this command. I don’t think it works anymore. As of Mac OS Mojave, you have to press ⌘ ⇧ 5, click options and then select Other Location… to choose a new default save location for screenshots.

Screenshot directly from terminal

There’s a hidden terminal command screencapture that you can use to capture a screenshot of your current window.

Capture the screen, save to example.png

screencapture example.png

Start screen recording from the terminal

You can even use screencapture to record video. The -V flag specifies to capture a video and the -A flag specifies to capture audio as well.

This is mostly just for fun, it’s not as practical as the other ways to go about doing the same thing. If you don’t want to use the terminal type ⌘ ⇧ 5 which will give you a host of options to choose from. This is a new feature in OS X Mojave.

Change default screenshot location

I like to put my screenshots in the ~/Downloads directory. Luckily there’s a terminal command for that.


Custom Sound Effects

You can change the alert sound on your Mac to any .aiff file. Your alert sounds are located in ~/Library/Sounds.

Move cursor with the mouse in terminal

This is a cool trick I just discovered. Start typing out a command on the terminal, and then hold ⌥

Now try clicking on a different part of the command you’re entering. It will move the cursor to that location!

Update Software in the Terminal

You can actually update the software on your computer directly from the terminal.


Disable User Photo

Setting Keyboard Shortcuts from Terminal

Store your keyboard shortcuts in the directory ~/Library/KeyBindings/DefaultKeyBinding.dict. Note that you have to first create ~/Library/KeyBindings since it won’t exist at first.

Note: Any shortcuts you make using this method will not appear in the keyboard shortcut settings page in your computer.

Fix Permissions

If you mess up your /etc files, like I did when I accidentally made every file executable, you can run this command to reset all of the permissions.

If you mess up your /etc/sudoers file, you’ll have to boot into single-user mode with ⌘ S during power on. From there, you can enter the following commands.


defaults is a powerful tool to utilize when exporting and importing settings across machines. Although there is no built-in method to sync keyboard shortcuts across computers, you can use the defaults program to set various keyboard shortcuts. When doing so, refer to the syntax below for how to denote modifier keys:

Tip: You can replace NSGlobalDomain with the -g flag to specify that the defaults command is global in scope.

Customize Launch Application for File Extension

The file that controls which app launches for a file is located here:


Default Application

You can install the command duti on homebrew to configure the default application that opens when you click on a file with a particular file extension. I’ve included an example below:

Delete FaceTime Popup

pkill -9 FaceTimeNotificationService

macOS notes


# Convert `example.svg` into a 1000x1000 .png file
qlmanage -ts 1000 -o . example.svg


The networksetup command allows you to configure your System Preference’s Network settings directly from your terminal.


There is a hidden command, called airport. To use it, add the following directory to your ${PATH}




Note: You have to run all of these as root, so before using tmutil, start with sudo -i

Speeding Up Time Machine Backups

If you are having trouble because time machine is taking too long, there’s a way to speed up the pace of the back-up.

The changes made in this command are temporary, they will automatically reset to their default state on their own once the computer has been rebooted.

Saving Local Snapshots

By default, Time Machine will create local snapshots, locally stored backup volumes when it can’t connect to your Time Capsule.

Excluding Certain Files & Folders

By default, Time Machine will back up everything on your drive. You may, however, have data from large directories stored elsewhere. If so, it might be a good idea to exclude that directory from Time Machine’s backups, in the interest of saving space.

Note: By default, Time Machine will continue to ignore the files in an excluded directory even if you move the directory somewhere else. To have an absolute path excluded instead, use the -p flag.

You can also check if a given file, directory, or volume is excluded

Restoring Files

tmutil restore


macOS has a more robust alternative to cron which allows daemon processes to be triggered on a systematic fashion. Using the launchctl (launch control) command, you can create daemon processes that will automatically run by the system.

These files take the form of plist files and are found in several system directories:

If you write or install personal plist files, they will ideally go in the home directory. A good example file to begin understanding the syntax can be located in /System/Library/LaunchDaemons/ssh.plist, which is the file used to launch the ssh daemon server that listens for incoming ssh connections.

Sample launch agent, located in ~/Library/LaunchAgents/com.example.transmission.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "">
<plist version="1.0">
      <!-- The absolute path to the executable file -->

      <!-- The first argument supplied to the program -->

      <!-- The second argument supplied to the program -->


If you’re setting up processes in /Library/LaunchDaemons, which are run as the root user, then make sure to set the file permissions appropriately using chown root:wheel <file> and chmod 644 <file>

Note: launchtl keeps an un-erasable record of disabled/enabled launch daemons. If you make a typo when adding daemon, and disable it, there is no way to erase it as an entry.

Create User from Command Line

Adding a new user to a Mac computer from a Terminal window requires you to define the user’s name, set a password, create the user’s home directory and configure their system permissions.

  1. Create a user named tommy
dscl . create /Users/tommy
  1. Set tommy's shell to /bin/zsh
dscl . create '/Users/tommy' UserShell '/bin/zsh'
  1. Set Tommy’s have the home directory /Users/tommy
dscl . create '/Users/tommy' NFSHomeDirectory '/Users/tommy'
createhomedir -u tommy -c
  1. Set tommy’s RealName to Tommy Trojan
dscl . create '/Users/tommy' RealName 'Tommy Trojan'
  1. Give tommy a UID number, (for instance, 502)
dscl . create '/Users/tommy' UniqueID 502
  1. Give tommy the primary group ID of 20 (the default for the staff group on macOS)
dscl . create '/Users/username' PrimaryGroupID 20
  1. Give tommy the password fighton
dscl . passwd /Users/tommy 'fighton'
  1. Add tommy to the list of user’s that can be logged into with ssh
dseditgroup -o edit -t user -a tommy
  1. Optionally add tommy to the list of admin users on the computer
dseditgroup -o edit -d tommy -t user admin

Hidden Users

Tip: This is the command that is equivalent to checking the box “Allow user to administer this computer” on the Users & Groups page

Update: Apparently DSCL is no longer the recommended way to create users, and instead one should use the sysadminctl command instead. A tutorial has been included below.


Use the existing admin account ‘billy’ whose password is ‘gobruins’

to allow the new admin account ‘tommy’ to login with the ‘fighton’ password

sysadminctl -adminUser ‘billy’ -adminPassword ‘gobruins’ -secureTokenOn ‘tommy’ -password ‘fighton’

## `fdesetup`

* Restart the computer, but bypass FileVault

sudo fdesetup authrestart

Single User Mode

Power Sound

Playing the power sound

afplay /System/Library/CoreServices/

System Integrity Protection

If you need to make changes to the file system, it might require disabling system integrity protection. By default, the following directories are protected:

  1. /System
  2. /usr
  3. /bin
  4. /sbin
  5. /var

There are three directories that are not protected:

  1. /Applications
  2. /Library
  3. /usr/local

Configuring the Login Page

Note: It’s preferrable to have these processes launch as LaunchAgents, but LoginHooks still work in the latest version of macOS.

Tip: You can also just press option-return to toggle this view-mode if you’d rather not enable it by default


Something learned from man hdiutil: /dev/rdisk nodes are character-special devices, but are “raw” in the BSD sense and force block-aligned I/O. They are closer to the physical disk than the buffer cache. /dev/disk nodes, on the other hand, are buffered block-special devices and are used primarily by the kernel’s filesystem code. In layman’s terms /dev/rdisk goes almost directly to disk and /dev/disk goes via a longer more expensive route

macOS Books

New to macOS Catalina is the Books application, which provides a cleaner interface for handling audiobooks on your Mac.

macOS Notes


Virtual Network Computing VNC

Virtual Network Computing, or VNC, is more commonly known as Screen Sharing, as this is the name of the application used for VNC on macOS. Your computer listens for VNC connections on port 5900, and you can use the vnc:// syntax to reach a particular user at a particular address.

Icon Folder

Icons are located in /System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/ SD Card Icons are located in /System/Library/Extensions/IOSCSIArchitectureModelFamily.kext/Contents/Resources/ Drive Icons are located in /System/Library/Extensions/IOStorageFamily.kext/Contents/Resources/

Filetype Conversion for Printing

cupsfilter -m 'application/postscript' file.txt >
cupsfilter -m 'application/pdf' file.txt > file.pdf


The defaults command can be used to configure many hidden settings available in macOS.


You can prohibit the modification of Finder preferences by selecting Preferences... in the menu bar. As to why you’d want to do this, I have no idea, but here you go:

Similarly, you could prohibit the Go to folder action in Finder as well, for whatever reason

If you’re tired of .DS_Store files popping up in all of your directories, there’s a command to disable them entirely. Before you do however, it’s worth nothing that the .DS_Store file is one that contains useful metadata about your file system browsing preferences, such as “Whether to open a folder in ‘Application View’ or in ‘List View’”