macOS Cookbook

Access macOS' clipboard via command line

Use pbcopy & pbpaste

# copy the output of the `pwd` command to the clipboard.
pwd | pbcopy

source


Increase the key repeat rate beyond OSX's limit

On Mac OS X, open the Global Preferences plist

open ~/Library/Preferences/.GlobalPreferences.plist

Then change the KeyRepeat field. Smaller numbers will speed up your cursor rate. The settings dialog will only set it to a minimum of 2, so if you go to 0 or 1, you'll get a faster cursor.

I had to reboot for this to take effect.

source


Change where screenshots are saved

In terminal, edit the preferences of the screencapture utility:

defaults write com.apple.screencapture location /folder/path

source


Open a plist file and display it in a human readable format

In terminal, use the plutil utility:

plutil -p ~/path/to/pref-file/com.vendor.app.plist

source


Restart OSX's SystemUIServer

In terminal, type:

killall SystemUIServer

source


List all volumes

diskutil list

Hide/unhide a system file or folder

Hide:

chflags hidden {target}

Unhide:

chflags nohidden {target}

Show hidden files

In Finder, use this shortcut: <kbd>CMD</kbd> <kbd>SHIFT</kbd> <kbd>DOT</kbd>.


Manage, create, delete Firefoxuser profiles

From terminal, navigate to /Applications and enter the following command:

/Applications/Firefox.app/Contents/MacOS/firefox-bin -P

The Profile Manager window will open, allowing to visually manage and edit profiles.

source


Flush the system's DNS cache

In a shell, type:

sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder

source