MAC


startup: keys | startup items

setup: setup assistant | system preferences | keychain access | terminal | finder | app store | xcode | homebrew | chrome | other apps | dtrace

using: command line | menu bar | finder | file suffix associations | cut and paste | save | factory reset

STARTUP

Keys

key mode description
safe mode doesn't run startup and login items
startup manager choose partition to boot from
⌘R recovery mode restore from backup; reinstall macOS; disk utility; network utility; firmware password; terminal
⌘S single-user mode boot into console as root
⌘V verbose mode display log messages while booting

Startup Items

$ ls \
  /System/Library/LaunchDaemons \
  /System/Library/LaunchAgents \
  /Library/LaunchDaemons \
  /Library/LaunchAgents \
  ~/Library/LaunchAgents

$ launchctl list

SETUP

Setup Assistant

A few of the choices made when running the Setup Assistant are hard to change later:

  • Name of account
  • FileVault on or off

System Preferences

general

  • uncheck "Allow Handoff between this Mac and your iCloud devices"

desktop & screen saver

  • Screen Saver: "Start after: 20 Minutes"

dock

  • check "Position on screen: Right"
  • check "Automatically hide and show the Dock"
  • slide "Size" towards "Small"

display

  • Uncheck "Show mirroring options in the menu bar when available"
  • Uncheck "Automatically adjust brightness"

energy saver

  • Battery: Turn display off after: 15 min
  • Power Adapter: Turn display off after: 1hr
  • Power Adapter: Check "Prevent computer from sleeping automatically when the display is off"

keyboard

  • "Touch Bar shows Expanded Control Strip"
  • Modifer Keys: ⇪ Caps Lock: ^ Control
  • Key Repeat: Fast
  • Delay Until Repeat: Short
  • Unselect and Remove everything under the "Text" tab
  • Unselect unused Shortcuts. Retain these:
    • "Show Desktop" F11
    • "Move left a space" ^←
    • "Move right a space" ^→
    • "Move focus to next window" ⌘`
    • "Select next source in input menu" ⌥⌘Space
    • "Screen shots"
    • "Show Spotlight search" ⌘Space
  • Select Shortcuts | Accessibility | Invert colors for ^⌥⌘8 key binding
  • Create the "Save As…" shortcut as described above
  • Bind "Paste and Match Style" to ⌘V as described above
  • Input Sources: add Polytonic Greek

trackpad

  • Unselect "Scroll direction: Natural"
  • Unselect unused gestures. Retain these:
    • "Secondary click"
    • "Swipe between pages", make it "Swipe with three fingers"
    • "Mission Control", make it "Swipe up with four fingers"

network

  • Under "Advanced" | "DNS", use OpenDNS IP addresses for name servers: 208.67.22{0,2}.22{0,2}.

Keychain Access Preferences

  • Chheck "Show keychain status in menu bar".

Terminal Preferences

  • Under "General", set the shell to /bin/zsh.
  • Under "Profiles" and "Text", increase the Font point size to 13.
  • Under "Profiles" and "Keyboard", check "Use Option as Meta key".

Finder Preferences

  • customize the sidebar
  • In Advanced, uncheck "Show warning before changing an extension"
  • In Advanced, change search to "Search the Current Folder"

App Store

Use the App Store to install Xcode.

I delete GarageBand and iMovie. If there are updates pending for those apps, then one must download the updates to dismiss the App Store badges. But once they are up-to-date, if they are deleted, App Store won't attempt to update them again.

Xcode

After Xcode is installed, one must agree to the license before the command line tools will work. Run this command:

$ sudo xcodebuild -license

Homebrew

Chrome Preferences

Remove the Google Docs extensions.

Install these extensions:

  • uBlock Origin
  • Disable HTML5 Autoplay
  • Blank New Tab
  • 1Password: Password Manager and Secure Wallet

Disable:

  • Autofill
  • Password saving
  • "Use a web service to help resolve navigation errors"
  • In Content settings, Flash: "Allow sites to run Flash"

Select:

  • In Content Settings, Cookies: "Block third-party cookies"

Other Apps

  • VMWare Fusion
    • Ubuntu LTS
    • Windows
  • Microsoft Office
  • Adobe Creative Cloud
  • Mathematica
  • MATLAB

DTrace

To enable DTrace, System Integrity Protection must be disabled. Boot in Recovery Mode, open a Terminal, and run:

$ csrutil disable

Similarly to enable SIP:

$ csrutil enable

USING

Command Line

command description
echo "lorem ispum" | pbcopy writes "lorem ipsum" to system clipboard
pbpaste > foo.txt writes system clipboard to foo.txt
open dir opens dir in Finder; switches to Finder window if dir already open
open /Applications/app.app launches app; switches to app if already open
open file.ext open file with application associated with the suffix ext
man -t foo | open -f -a /Applications/Preview.app render man page for foo as PostScript and display output with Preview.app
echo -n "\033]0;foo\007" set name of Terminal.app tab to foo
osascript -e 'tell application "iTunes"' -e "play" -e "end tell" execute AppleScript
say "I'm a Mac"
say -v '?'
tells speech synthesizer to say "I'm a Mac"
list available voices; go to System Preferences… | Accessibility | Speech to download more
hdiutil eject /Volumes/DARKSHADOWS2_DISC2 eject disk named DARKSHADOWS2_DISC2. Presumably you can "ls /Volumes" to see what is in the optical disk drive.
drutil eject eject disk in optical drive.
qlmanage -p file.jpg
qlmanage -p file.mpg
use quicklook to display file.jpg
use quicklook to play file.mpg
screencapture -T 10 foo.png capture screen in 10 seconds to foo.png
screencapture -T 10 -c capture screen in 10 seconds to clipboard
mdfind foo
mdfind -name foo
mdfind "foo bar"
mdfind -onlyin ~/Documents foo
search for files containing foo
search for file names containing foo
search for files containing foo and bar
restrict search to ~/Documents
sudo mdutil -a -i off
sudo mdutil -a -i on
turn Spotlight indexing off
turn Spotlight indexing on
SetFile -a V ~/Pictures/Porn
SetFile -a v ~/Pictures/Porn
makes ~/Pictures/Porn invisible in Finder
makes ~/Pictures/Porn visible in Finder
mdls /etc show metadata attributes for file
GetFileInfo file displays Mac specific file attributes for file
xattr [-l] NicePlayer.app list extended attributes on file. If there are any there will be an @ at the end of the ls -l mode string
xattr -d com.apple.quarantine NicePlayer.app remove quarantine from downloaded software
defaults write com.apple.finder _FXShowPosixPathInTitle -bool true put full path in Finder title bar
system_profiler dump system information (number of cores, amount of memory, etc)
xcrun ?? command line access to XCode
dscl . -read /Users/clark Password UniqueID PrimaryGroupID RealName NFSHomeDirectory UserShell Get password file entry for "clark"
defaults read dump all the System Preferences and application Preferences… values
putil -p ~/Library/Preferences/com.apple.dock.plist display a binary plist
sudo xcode-select -switch /Applications/Xcode.app if multiple versions of Xcode are installed, choose compiler, binutils, flex, bison. These tools are used by xcrun and xcodebuild. An Xcode.app directory can contain more than one set of these tools, in which case a path into the Xcode.app directory might be needed.
textutil convert between txt, html, doc, and rtf
diskutil
sips for prop in dpiHeight dpiWidth pixelHeight pixelWidth typeIdentifier format formatOptions space samplesPerPixel bitsPerSample hasAlpha; \
do sips -g $prop dachshund.jpg; \
done
____________________________________________________________________________________________ ______________________________________________

Menu Bar

Hold down the command key ⌘ when dragging to re-arrange the menu bar icons.

Finder

The /Applications directory contains .app directories. Clicking on them in the Finder launches the application. To browse the directory contents, right click the directory and select Show Package Contents.

The title bar of a Finder window contains the name, but not the full path name, of the directory being displayed. To see the full path one can right click on the name in the title. One gets a dropdown which can be used to navigate to any of the higher directories. A faster way to go to a different directory might be to type it in via ⇧⌘G.

If one selects and copies ⌘C any of the items in the directory, the full pathname of the item will be copied to the clipboard. This can be pasted ⌘V to the command line. (Although this works for the command line, it doesn't work for most other apps).

The Finder does not display Unix hidden files (i.e. with names starting with a period .). Also it doesn't show these standard Unix directories: /bin, /dev, /etc, /tmp, /usr, /var. Although you can configure Finder to make hidden files and standard Unix directories visible, it isn't worth it. If you are in Finder and you need to see these files, just switch to the command line. Unfortunately, if you are using the Open File… dialog from a GUI application, you must switch to the command line, move or copy the file to a visible path, and then switch back to the dialog.

File Suffix Associations

File suffixes are associated with applications. These determine which applications are used when a file is double clicked in the finder or the open command is used on the file at the command line.

Versions of Mac before Mac OS X put an embedded 4 byte code in a file to determine what application opens it.

The way to set a file suffix association with the Finder is to find a file with the suffix. Then

Right Click | Open With | Other...

Find and select the correct application. Check the "Always Open With" checkbox.

Cut and Paste

When performing a cut-and-paste, say from a Browser to Outlook, formatting information is sometimes carried along with the text. In the case of Outlook, it is possible to fix the formatting using the Format menu.

It is also possible to change the behavior of paste. Go to:

System Preferences... | Keyboard | Shortcuts | App Shortcuts

Click the + to add a new shortcut.

In Menu Title type Paste and Match Style.

In Keyboard Shortcut type ⌘V.

Save

Before version 10.7, Mac applications usually had Save and Save As menu items bound to ⌘S and ⇧⌘S. The first saves the document to its file path. The second allows the user to choose a file path to save the document at. In some situations (The document doesn't have a file path? The document has never been saved?) these two menu items behave identically.

In 10.7 the Apple-provided applications have four menu items Save, Duplicate, Rename…, and Move To… The first two are bound to ⌘S and ⇧⌘S and the last two don't have keyboard shortcuts.

To restore Save As… and bind ⇧⌘S to it, go to

System Preferences | Keyboard | Shortcuts | App Shortcuts

In the right pane, click + and type Save As… in the Menu Title box. Type ⇧⌘S in the Keyboard Shortcut box.

Factory Reset

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License