usage
commands
commands comments prints the user’s settings to standard output
prints the plist type for a given key
write a value for the given key
import a plist to a given domain
export a domain and all the keys as a plist
delete a given key or a domain / all keys for a given domain
prints the name of all domains
search all domains, keys, and values for a given word
usage
basic usage
Copy # gets all
$ defaults read DOMAIN
# gets
$ defaults read DOMAIN PROPERTY_NAME
# find
$ defaults find < KEYWOR D >
# get type
$ defaults read-type < DOMAI N > < KE Y >
# rename
$ defaults rename < DOMAI N > < OLD_KE Y > < NEW_KE Y >
# sets
$ defaults write DOMAIN PROPERTY_NAME VALUE
# resets a property
$ defaults delete DOMAIN PROPERTY_NAME
# resets preferences
$ defaults delete DOMAIN
list all domains
i.e.
Copy $ defaults domains | tr ',' '\n' | head
ContextStoreAgent
MobileMeAccounts
com.100hps.captin
com.ScooterSoftware.BeyondCompare
com.app77.pwsafemac
com.apple.AMPLibraryAgent
com.apple.ATS
com.apple.Accessibility
com.apple.AdLib
com.apple.AddressBook
defaults
programming
xCode
add additional Counterpart Suffixes
Copy # `"ViewModel" "View"`
$ defaults write com.apple.dt.Xcode IDEAdditionalCounterpartSuffixes -array-add "ViewModel" "View" && killall Xcode
# `"Router" "Interactor" "Builder"`
$ defaults write com.apple.dt.Xcode IDEAdditionalCounterpartSuffixes -array-add "Router" "Interactor" "Builder" && killall Xcode
show build durations
Copy $ defaults write com.apple.dt.Xcode ShowBuildOperationDuration -bool true && killall Xcode
add additional counterpart suffixes
Copy # add "ViewModel" and "View"
$ defaults write com.apple.dt.Xcode "IDEAdditionalCounterpartSuffixes" -array-add "ViewModel" "View" && killall Xcode
# add "Router", "Interactor" and "Builder"
$ defaults write com.apple.dt.Xcode "IDEAdditionalCounterpartSuffixes" -array-add "Router" "Interactor" "Builder" && killall Xcode
show build durations
Copy $ defaults write com.apple.dt.Xcode "ShowBuildOperationDuration" -bool "true" && killall Xcode
iTerm2
profile
Copy # reset
$ cd ~/Library/Preferences/com.googlecode.iterm2.plist
$ defaults delete com.googlecode.iterm2
prompt when quitting
Copy # disable
$ defaults write com.googlecode.iterm2 PromptOnQuit -bool false
terminal
Copy # UTF-8 encoding
$ defaults write com.apple.terminal StringEncodings -array 4
# theme
$ defaults write com.apple.terminal "Default Window Settings" -string "gruvbox-dark"
$ defaults write com.apple.terminal "Startup Window Settings" -string "gruvbox-dark"
# more
$ defaults read com.apple.terminal
enable security keyboard
[!NOTE|label:references:]
Copy $ defaults write com.apple.terminal SecureKeyboardEntry -bool true
line marks
Copy # disable
$ defaults write com.apple.terminal ShowLineMarks -int 0
modify theme
Copy $ osascript << EOD
tell application "Terminal"
local allOpenedWindows
local initialOpenedWindows
local windowID
set themeName to "Solarized Dark xterm-256color"
(* Store the IDs of all the open terminal windows. *)
set initialOpenedWindows to id of every window
(* Open the custom theme so that it gets added to the list
of available terminal themes (note: this will open two
additional terminal windows). *)
do shell script "open '$HOME/init/" & themeName & ".terminal'"
(* Wait a little bit to ensure that the custom theme is added. *)
delay 1
(* Set the custom theme as the default terminal theme. *)
set default settings to settings set themeName
(* Get the IDs of all the currently opened terminal windows. *)
set allOpenedWindows to id of every window
repeat with windowID in allOpenedWindows
(* Close the additional windows that were opened in order
to add the custom theme to the list of terminal themes. *)
if initialOpenedWindows does not contain windowID then
close (every window whose id is windowID)
(* Change the theme for the initial opened terminal windows
to remove the need to close them in order for the custom
theme to be applied. *)
else
set current settings of tabs of (every window whose id is windowID) to settings set themeName
end if
end repeat
end tell
EOD
developer mode
[!NOTE|label:references:]
Copy $ sudo spctl developer-mode enable-terminal
Terminal added as a developer tool. Enable in the Privacy & Security Settings.
# or
$ sudo /usr/sbin/DevToolsSecurity --enable
utilities
startup sounds
Copy # disable
$ sudo nvram StartupMute=%01
# or
$ sudo nvram SystemAudioVolume= " "
# enable
$ sudo nvram StartupMute=%00
forbidden spell automatic correction
Copy $ defaults write -g NSAutomaticQuoteSubstitutionEnabled -bool false
$ defaults write -g NSAutomaticDashSubstitutionEnabled -bool false
$ defaults write -g NSAutomaticSpellingCorrectionEnabled -bool false
disable notification centers
Copy $ launchctl unload -w /System/Library/LaunchAgents/com.apple.notificationcenterui.plist && killall NotificationCenter
are you sure you want to open this application?
Copy # old version
$ sudo spctl --master-disable
# new version
$ sudo spctl --global-disable
Globally disabling the assessment system needs to be confirmed in System Settings
$ defaults write com.apple.LaunchServices LSQuarantine -bool false
disable warning for unknown resource open
Copy $ defaults write com.apple.LaunchServices LSQuarantine -bool false
screenshot
suppress "Allow For One Month"
[!NOTE|label:references:]
Copy # check info
$ defaults read ~/Library/Group \ Containers/group.com.apple.replayd/ScreenCaptureApprovals.plist
{
"/Applications/Bob.app/Contents/MacOS/Bob" = "2024-09-19 22:33:43 +0000" ;
"/Applications/GIF Brewery 3.app/Contents/MacOS/GIF Brewery 3" = "2024-09-21 10:34:48 +0000" ;
"/Applications/Snipaste.app/Contents/MacOS/Snipaste" = "2024-10-22 07:04:02 +0000" ;
"/Applications/zoom.us.app/Contents/MacOS/zoom.us" = "2024-10-15 06:12:23 +0000" ;
}
# update one
$ defaults write ~/Library/Group \ Containers/group.com.apple.replayd/ScreenCaptureApprovals.plist \
"/Applications/Snipaste.app/Contents/MacOS/Snipaste" \
-date "3024-01-01 00:00:00 +0000"
# update all
$ defaults read ~/Library/Group \ Containers/group.com.apple.replayd/ScreenCaptureApprovals.plist |
sed -nr 's|^\s*"([^"]+)".*$|\1|p' |
while read -r _name ; do
defaults write ~/Library/Group \ Containers/group.com.apple.replayd/ScreenCaptureApprovals.plist \
"${_name}" -date "3024-01-01 00:00:00 +0000" ;
done
# verify
$ defaults read ~/Library/Group \ Containers/group.com.apple.replayd/ScreenCaptureApprovals.plist
{
"/Applications/Bob.app/Contents/MacOS/Bob" = "3024-01-01 00:00:00 +0000" ;
"/Applications/GIF Brewery 3.app/Contents/MacOS/GIF Brewery 3" = "3024-01-01 00:00:00 +0000" ;
"/Applications/Snipaste.app/Contents/MacOS/Snipaste" = "3024-01-01 00:00:00 +0000" ;
"/Applications/zoom.us.app/Contents/MacOS/zoom.us" = "3024-01-01 00:00:00 +0000" ;
}
set screenshot location
Copy # `~/Picture/Screenshots`
$ defaults write com.apple.iphonesimulator ScreenShotSaveLocation -string ~/Pictures/Screenshots
# `~/Picture/Simulator Screenshots`
$ defaults write com.apple.iphonesimulator ScreenShotSaveLocation -string ~/Pictures/Simulator Screenshots
shadow
Copy # show
$ defaults write com.apple.screencapture disable-shadow -bool false && killall SystemUIServer
# disable
$ defaults write com.apple.screencapture disable-shadow -bool true && killall SystemUIServer
include date
Copy # include
$ defaults write com.apple.screencapture include-date -bool true && killall SystemUIServer
# disable
$ defaults write com.apple.screencapture include-date -bool false && killall SystemUIServer
save location
Copy # `~/Desktop`
$ defaults write com.apple.screencapture location -string ~/Desktop && killall SystemUIServer
# `~/Pictures`
$ defaults write com.apple.screencapture location -string ~/Pictures && killall SystemUIServer
thumbnail
Copy # display
$ defaults write com.apple.screencapture show-thumbnail -bool true
# disable thumbnail
$ defaults write com.apple.screencapture show-thumbnail -bool false
screenshot format
Copy # `png`
$ defaults write com.apple.screencapture type -string png
# `jpg`
$ defaults write com.apple.screencapture type -string jpg
finder
hidden file
show hidden files
Copy # show
$ defaults write com.apple.Finder AppleShowAllFiles -bool true && killall Finder
# or
$ defaults write com.apple.finder AppleShowAllFiles YES
# disable
$ defaults write com.apple.Finder AppleShowAllFiles -bool false && killall Finder
# or
$ defaults write com.apple.Finder AppleShowAllFiles NO
disable the .DS_Store
and ._*
[!NOTE|label:references:]
more details
.DS_Store
– The name of a file in the Apple OS X operating system for storing custom attributes of a folder such as the position of icons or the choice of a background image (Read more)
.Spotlight-V100
– This file holds information to speed up the 'Spotlight Search' feature. Deleting would simply force this information to be re-indexed if you performed another Spotlight Search for an item in this folder.
.apDisk
– This file holds information about shared folders and can be safely removed as it will be automatically re-created if Apple needs it.
.VolumeIcon.icns
– This file is used to store the icon of the volume (USB device) if the volume uses a custom icon and not the default icon. If you want the device to continue using this default icon, or if the folder/device you want to clean contains an application, you might want to keep this file in your system. As a side note, if you wanted to create a custom icon for your device you could create/download an .icns file and rename it .VolumeIcon.icns and place in your folder/device.
.fseventsd
– This file is used as a buffer for the File System Events daemon. If you are using a program that is monitoring this folder/device, this file might be used to store temporary data.
.Trash
& .Trashes
– These folders are used to hold deleted items the same way that the 'Trash' icon from the dock works. If you don't need this feature on your folder/device, you can clean this folder to save space.
.TemporaryItems
– This file is used by the OS to hold temporary data when files are being copied/moved/appended. If you are running any programs that are accessing the folder/device you want to clean, and you aren't copying or moving any files, then this file can simply hold old data for caching.
Copy # network drives
$ defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
# usb drives
$ defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true
# enable
$ defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool false
$ defaults write com.apple.desktopservices DSDontWriteUSBStores -bool false
result
Copy $ defaults read com.apple.desktopservices
{
DSDontWriteNetworkStores = 1 ;
DSDontWriteUSBStores = 1 ;
}
Copy # hidden quite
$ defaults write com.apple.finder QuitMenuItem -bool false && killall Finder
# enable quite
$ defaults write com.apple.finder QuitMenuItem -bool true && killall Finder
default location
Copy $ defaults write com.apple.finder NewWindowTarget -string "PfDe"
$ defaults write com.apple.finder NewWindowTargetPath -string "file://${HOME}/"
timestamp on zip filenames
Copy # enable
$ defaults write com.apple.Finder ArchiveTimestamp -bool true
# disable
$ defaults delete com.apple.Finder ArchiveTimestamp
empty trashcan after 30 days
Copy $ defaults write com.apple.finder "FXRemoveOldTrashItems" -bool "true" && killall Finder
finder sound
Copy # turn on
$ defaults write com.apple.Finder FinderSounds -bool false
# turn off
$ defaults delete com.apple.Finder FinderSounds
trash sounds
Copy # disable
$ defaults write com.apple.Finder WarnOnEmptyTrash -bool false
extension
Copy # show
$ defaults write NSGlobalDomain AppleShowAllExtensions -bool true && killall Finder
# disable
$ defaults write NSGlobalDomain AppleShowAllExtensions -bool false && killall Finder
# show warning when change file extension warning
$ defaults write com.apple.finder FXEnableExtensionChangeWarning -bool true && killall Finder
# silent when change file extension warning
$ defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false && killall Finder
view
full POSIX path in toolbar title
Copy $ defaults write com.apple.finder _FXShowPosixPathInTitle -bool true
column view
[!TIP]
Copy $ defaults write com.apple.finder FXPreferredViewStyle clmv && killall Finder
keep folder on top
Copy $ defaults write com.apple.finder "_FXSortFoldersFirst" -bool "true" && killall Finder
# for desktop
$ defaults write com.apple.finder "_FXSortFoldersFirstOnDesktop" -bool "true" && killall Finder
animation when opening the Info window in Finder
Copy # disable
$ defaults write com.apple.Finder DisableAllAnimations -bool true
icon
set sidebar icon size
Copy # small: 1
$ defaults write NSGlobalDomain NSTableViewDefaultSizeMode -int 1 && killall Finder
# medium: 2
$ defaults write NSGlobalDomain NSTableViewDefaultSizeMode -int 2 && killall Finder
# large: 3
$ defaults write NSGlobalDomain NSTableViewDefaultSizeMode -int 3 && killall Finder
show item info near icons
Copy $ /usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:showItemInfo true" ~/Library/Preferences/com.apple.finder.plist
$ /usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:showItemInfo true" ~/Library/Preferences/com.apple.finder.plist
$ /usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:showItemInfo true" ~/Library/Preferences/com.apple.finder.plist
show item info to right of icons
Copy $ /usr/libexec/PlistBuddy -c "Set DesktopViewSettings:IconViewSettings:labelOnBottom false" ~/Library/Preferences/com.apple.finder.plist
snap-to-grid for icons
Copy $ /usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist
$ /usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist
$ /usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist
increase grid spacing for icons
Copy $ /usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:gridSpacing 100" ~/Library/Preferences/com.apple.finder.plist
$ /usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:gridSpacing 100" ~/Library/Preferences/com.apple.finder.plist
$ /usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:gridSpacing 100" ~/Library/Preferences/com.apple.finder.plist
increase the size of icons
Copy $ /usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:iconSize 80" ~/Library/Preferences/com.apple.finder.plist
$ /usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:iconSize 80" ~/Library/Preferences/com.apple.finder.plist
$ /usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:iconSize 80" ~/Library/Preferences/com.apple.finder.plist
bars
show path bar
Copy $ defaults write com.apple.finder ShowPathbar -bool true
show status bar
Copy $ defaults write com.apple.finder ShowStatusBar -bool true
show icon in the title bar
Copy $ defaults write com.apple.universalaccess "showWindowTitlebarIcons" -bool "true" && killall Finder
adjust toolbar title rollover delay
Copy # `0.5`
$ defaults write NSGlobalDomain NSToolbarTitleViewRolloverDelay -float 0.5 && killall Finder
# `0`
$ defaults write NSGlobalDomain NSToolbarTitleViewRolloverDelay -float 0 && killall Finder
# `1`
$ defaults write NSGlobalDomain NSToolbarTitleViewRolloverDelay -float 1 && killall Finder
panel
Copy # expand save panel by default
$ defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true
$ defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode2 -bool true
# expand print panel by default
$ defaults write NSGlobalDomain PMPrintingExpandedStateForPrint -bool true
$ defaults write NSGlobalDomain PMPrintingExpandedStateForPrint2 -bool true
others
search scope
[!TIP]
Copy # use current directory as default search scope
$ defaults write com.apple.finder FXDefaultSearchScope -string "SCcf"
disk image verification
Copy # disable
$ defaults write com.apple.frameworks.diskimages skip-verify -bool true
$ defaults write com.apple.frameworks.diskimages skip-verify-locked -bool true
$ defaults write com.apple.frameworks.diskimages skip-verify-remote -bool true
silent quiet
Copy # quit printer app once the print jobs complete
$ defaults write com.apple.print.PrintingPrefs "Quit When Finished" -bool true
save to disk or iCloud
Copy # yes: save to iCloud
$ defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool true
# no: save to disk by default
$ defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false
select && copy from quicklook
Copy $ defaults write com.apple.finder QLEnableTextSelection -bool true ; killall Finder
spring loading
Copy # enable spring loading
$ defaults write NSGlobalDomain com.apple.springing.enabled -bool true
# disable spring loading delay
defaults write NSGlobalDomain com.apple.springing.delay -float 0
volume mounted
Copy # open finder automatically
$ defaults write com.apple.frameworks.diskimages auto-open-ro-root -bool true
$ defaults write com.apple.frameworks.diskimages auto-open-rw-root -bool true
$ defaults write com.apple.finder OpenWindowForNewRemovableDisk -bool true
desktop
show wallpaper location
Copy # show
$ defaults write com.apple.dock desktop-picture-show-debug-text -bool true
# not show
$ defaults delete com.apple.dock desktop-picture-show-debug-text
keep folders on top
Copy $ defaults write com.apple.finder "_FXSortFoldersFirstOnDesktop" -bool "true" && killall Finder
quick hidden desktop icons
Copy $ defaults write com.apple.finder CreateDesktop -bool false && killall Finder
# revert back
$ defaults write com.apple.finder CreateDesktop true && killall Finder
icons
show external disk
Copy $ defaults write com.apple.finder ShowExternalHardDrivesOnDesktop -bool true
show hard drive
Copy $ defaults write com.apple.finder ShowHardDrivesOnDesktop -bool false
show connected servers
Copy $ defaults write com.apple.finder ShowMountedServersOnDesktop -bool true
show removeable media ( CDs, DVDs and iPods )
Copy $ defaults write com.apple.finder ShowRemovableMediaOnDesktop -bool true
transparency
Copy # disable transparency
$ defaults write com.apple.universalaccess reduceTransparency -bool true
highlight color
Copy # green
$ defaults write NSGlobalDomain AppleHighlightColor -string "0.764700 0.976500 0.568600"
# black
$ defaults write NSGlobalDomain AppleHighlightColor -string "0.500000 0.500000 0.500000"
flash clock time separators
Copy # stay solid
$ defaults write com.apple.menuextra.clock FlashDateSeparators -bool false && killall SystemUIServer
# separator flashes
$ defaults write com.apple.menuextra.clock FlashDateSeparators -bool true && killall SystemUIServer
set menu bar digital clock format
[!NOTE|label:region settings:]
EEE
for 3-letter day of the week.
d MMM
for day of the month and 3-letter month.
Copy # `EEE d MMM HH:mm:ss`
$ defaults write com.apple.menuextra.clock DateFormat -string "EEE d MMM HH:mm:ss"
# `EEE h:mm:ss`
$ defaults write com.apple.menuextra.clock DateFormat -string "EEE h:mm:ss"
# `EEE HH:mm:ss`
$ defaults write com.apple.menuextra.clock DateFormat -string "EEE HH:mm:ss"
menu bar transparency
Copy # disable transparency
$ defaults write NSGlobalDomain AppleEnableMenuBarTransparency -bool false
trackpad
[!TIP]
click weight
Copy # light: 0
$ defaults write com.apple.AppleMultitouchTrackpad "FirstClickThreshold" -int "0"
# medium: 1
$ defaults write com.apple.AppleMultitouchTrackpad "FirstClickThreshold" -int "1"
# firm: 2
$ defaults write com.apple.AppleMultitouchTrackpad "FirstClickThreshold" -int "2"
enable dragging with drag lock
Copy $ defaults write com.apple.AppleMultitouchTrackpad "DragLock" -bool "true"
Enable dragging without drag lock
Copy $ defaults write com.apple.AppleMultitouchTrackpad "Dragging" -bool "true"
enable dragging with three finger drag
Copy $ defaults write com.apple.AppleMultitouchTrackpad "TrackpadThreeFingerDrag" -bool "true"
dock
[!NOTE|label:references:]
show
add a blank space
Copy $ defaults write com.apple.dock persistent-apps -array-add '{tile-data={}; tile-type="spacer-tile";}' && killall Dock
add recent items folder
Copy $ defaults write com.apple.dock persistent-others -array-add '{"tile-data" = {"list-type" = 1;}; "tile-type" = "recents-tile";}' && killall Dock
# current status
$ defaults read com.apple.Dock persistent-others
(
)
group window by app
Copy $ defaults write com.apple.dock "expose-group-apps" -bool "true" && killall Dock
position
[!TIP]
Copy # `left`
$ defaults write com.apple.dock orientation -string left && killall Dock
# `right`
$ defaults write com.apple.dock orientation -string right && killall Dock
# `bottom`
$ defaults write com.apple.dock orientation -string bottom && killall Dock
disable delay of dock displaying
Copy $ defaults write com.apple.Dock autohide-delay -float 0 && killall Dock
show recently
Copy # show
$ defaults write com.apple.dock show-recents -bool true && killall Dock
# disable show
$ defaults write com.apple.dock show-recents -bool false && killall Dock
recent use rearrange space
Copy # disable
$ defaults write com.apple.dock mru-spaces -bool false && killall Dock
icon
highlight icon
Copy $ defaults write com.apple.dock mouse-over-hilite-stack -bool true && killall Dock
# revert
$ defaults delete com.apple.dock mouse-over-hilite-stack && killall Dock
icon size
tilesize
Copy # `48`
$ defaults write com.apple.dock tilesize -int 48 && killall Dock
# read current value
$ defaults read com.apple.dock tilesize
46
largesize
Copy # 72
$ defaults write com.apple.dock largesize -float 72 && killall Dock
remove none-opened apps ( show only active Apps )
Copy $ defaults write com.apple.dock static-only -boolean true && killall Dock
# revert
$ defaults delete com.apple.dock static-only && killall Dock
whether show hidden icon
Copy # show
$ defaults write com.apple.dock showhidden -bool true && killall Dock
# not show
$ defaults delete com.apple.Dock showhidden && killall Dock
animation
opening applications animation
Copy # enable
$ defaults write com.apple.dock launchanim -bool true
# disable
$ defaults write com.apple.dock launchanim -bool false
animations when opening and closing windows
Copy # disable
$ defaults write NSGlobalDomain NSAutomaticWindowAnimationsEnabled -bool false
animations when opening a Quick Look window
Copy # disable
$ defaults write -g QLPanelAnimationDuration -float 0
animation of minimize windows
Copy # * `suck`
$ defaults write com.apple.dock mineffect suck && killall Dock
# `genie`
$ defaults write com.apple.dock mineffect genie && killall Dock
# `scale`
$ defaults write com.apple.dock mineffect -string scale && killall Dock
autohide
Copy # auto hide
$ defaults write com.apple.dock autohide -bool true && killall Dock
# always show
$ defaults write com.apple.dock autohide -bool false && killall Dock
autohide animation delay
[!NOTE|label:precondition]
Copy # `0.5`
$ defaults write com.apple.dock autohide-time-modifier -float 0.5 && killall Dock
# `2`
$ defaults write com.apple.dock autohide-time-modifier -float 2 && killall Dock
# `0`
$ defaults write com.apple.dock autohide-time-modifier -float 0 && killall Dock
# read current value
$ defaults read com.apple.dock autohide-time-modifier
1
autohide delay
[!NOTE|label:precondition]
Copy # `0.5`
$ defaults write com.apple.dock autohide-delay -float 0.5 && killall Dock
# `0`
$ defaults write com.apple.dock autohide-delay -float 0 && killall Dock
# read current value
$ defaults read com.apple.dock autohide-delay
0
others
2D Dock
Copy $ defaults write com.apple.dock no-glass -bool true
enable iTunes track notifications in the dock
Copy $ defaults write com.apple.dock itunes-notifications -bool true
highlight hover effect
Copy # enable highlight
$ defaults write com.apple.dock mouse-over-hilte-stack -bool true
speeding up mission control animations
Copy $ defaults write com.apple.dock expose-animation-duration -float 0.1
$ defaults write com.apple.dock "expose-group-by-app" -bool true
spring loading for all Dock items
Copy $ defaults write com.apple.dock enable-spring-load-actions-on-all-items -bool true
indicator lights for open apps
Copy # show indicators lights
$ defaults write com.apple.dock show-process-indicators -bool true
mission control
rearrange automatically
Copy # base on most of recent use
$ defaults write com.apple.dock mru-spaces -bool true && killall Dock
# keep space arrangement
$ defaults write com.apple.dock mru-spaces -bool false && killall Dock
switch to space with open windows
Copy $ defaults write NSGlobalDomain "AppleSpacesSwitchOnActivate" -bool "true" && killall Dock
displays have separate spaces
Copy $ defaults write com.apple.spaces "spans-displays" -bool "true" && killall SystemUIServer
keyboard & trackpad
[!NOTE|label:references:]
key repeat
Copy $ defaults write NSGlobalDomain ApplePressAndHoldEnabled -boolean false
# or
$ defaults write -g ApplePressAndHoldEnabled -bool false
restore
Copy $ defaults delete -g ApplePressAndHoldEnabled
key repeat for in specific apps
Copy # chrome
$ defaults delete -g ApplePressAndHoldEnabled
$ defaults write "com.google.Chrome" ApplePressAndHoldEnabled 0
# vscode
$ defaults delete com.microsoft.VSCode ApplePressAndHoldEnabled
$ defaults write com.microsoft.VSCode ApplePressAndHoldEnabled -bool false
fast keyboard response
Copy $ defaults write NSGlobalDomain KeyRepeat -int 0.02
reduce key repeat delay
Copy $ defaults write NSGlobalDomain InitialKeyRepeat -int 12
enable full keyboard access
[!TIP] Enable full keyboard access for all controls (e.g. enable Tab in modal dialogs)
Copy $ defaults write NSGlobalDomain AppleKeyboardUIMode -int 3
auto-correct
Copy # disable
$ defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false
# enable
$ defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool true
keyboard illumination
Copy # turn off keyboard illumination when computer is not used for 5 minutes
$ defaults write com.apple.BezelServices kDimTime -int 300
increasing sound quality for bluetooth
Copy $ defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Min (editable)" -int 40
enable tap to click
Copy $ defaults write com.apple.AppleMultitouchTrackpad Clicking -int 1
$ defaults -currentHost write NSGlobalDomain com.apple.mouse.tapBehavior -int 1
$ defaults write NSGlobalDomain com.apple.mouse.tapBehavior -int 1
enable three finger to drag
Copy $ defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadThreeFingerDrag -bool true
$ defaults write com.apple.AppleMultitouchTrackpad TrackpadThreeFingerDrag -bool true
trackpad & mouse speed
Copy $ defaults write -g com.apple.trackpad.scaling 2
$ defaults write -g com.apple.mouse.scaling 2.5
Copy # get display off timer
$ sudo pmset -g | grep displaysleep
displaysleep 180
# set display off timer
$ sudo pmset -a displaysleep 30
battery percent
Copy # show battery percent
$ defaults write com.apple.menuextra.battery ShowPercent -string "YES"
remaining battery time
Copy $ defaults write com.apple.menuextra.battery ShowTime -string "YES"
browser
chrome
sensitive backswipe
Copy # disable on trackpads
$ defaults write com.google.Chrome AppleEnableSwipeNavigateWithScrolls -bool false
$ defaults write com.google.Chrome.canary AppleEnableSwipeNavigateWithScrolls -bool false
# disable on magic mouse
$ defaults write com.google.Chrome AppleEnableMouseSwipeNavigateWithScrolls -bool false
$ defaults write com.google.Chrome.canary AppleEnableMouseSwipeNavigateWithScrolls -bool false
system-native print preview
Copy $ defaults write com.google.Chrome DisablePrintPreview -bool true
$ defaults write com.google.Chrome.canary DisablePrintPreview -bool true
expand the print dialog
Copy $ defaults write com.google.Chrome PMPrintingExpandedStateForPrint2 -bool true
$ defaults write com.google.Chrome.canary PMPrintingExpandedStateForPrint2 -bool true
safari
show full url
Copy $ defaults write com.apple.Safari "ShowFullURLInSmartSearchField" -bool "true" && killall Safari
dns prefetching
Copy # disable
$ defaults write com.apple.safari WebKitDNSPrefetchingEnabled -boolean false
# enable
$ defaults write com.apple.safari WebKitDNSPrefetchingEnabled -boolean true
bookmarks
Copy # hidden bookmark
$ defaults write com.apple.Safari ShowFavoritesBar -bool false
# removing useless icons from bookmark bar
defaults write com.apple.Safari ProxiesInBookmarksBar "()"
sidebar
Copy # hidden
$ defaults write com.apple.Safari ShowSidebarInTopSites -bool false
thumbnail cache
Copy # disable
$ defaults write com.apple.Safari DebugSnapshotsUpdatePolicy -int 2
debug mode
Copy # enable debug menu
$ defaults write com.apple.Safari IncludeInternalDebugMenu -bool true
# or
$ defaults write com.apple.Safari IncludeInternalDebugMenu 1
standard deply
Copy # disable
$ defaults write com.apple.Safari WebKitInitialTimedLayoutDelay 0.25
develop menu and the web inspector
Copy # develop menu and the web inspector
$ defaults write com.apple.Safari IncludeDevelopMenu -bool true
$ defaults write com.apple.Safari WebKitDeveloperExtrasEnabledPreferenceKey -bool true
$ defaults write com.apple.Safari "com.apple.Safari.ContentPageGroupIdentifier.WebKit2DeveloperExtrasEnabled" -bool true
# context menu for web inspector
$ defaults write NSGlobalDomain WebKitDeveloperExtras -bool true
search banners
Copy # search banners default to Contains instead of Starts With
$ defaults write com.apple.Safari FindOnPageMatchesWordStartsOnly -bool false
backspace key to previous page
Copy # disable
$ defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2BackspaceKeyNavigationEnabled -bool true
safari font size
Copy $ defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2MinimumFontSize -int 14
system
hot corners
[!TIP|label:references:]
Copy # bottom left - desktop
$ defaults write com.apple.dock wvous-bl-corner -int 4 && killall Dock
# bottom right - application windows
$ defaults write com.apple.dock wvous-br-corner -int 3 && killall Dock
# top right - mission control
$ defaults write com.apple.dock wvous-tr-corner -int 2 && killall Dock
# current settings
$ defaults read com.apple.dock | grep corner
"wvous-bl-corner" = 4;
"wvous-br-corner" = 3;
"wvous-tr-corner" = 2;
# or
$ defaults read com.apple.dock | grep corner | sed -n -E 's/ "(.+)" = (.+);/\1=\2/p'
wvous-bl-corner=4
wvous-br-corner=3
wvous-tr-corner=2
modifiers
[!TIP|label:references:]
Copy # current settings
$ defaults read com.apple.dock | grep 'modifier'
"autohide-time-modifier" = "0.5";
"wvous-bl-modifier" = 0;
"wvous-br-modifier" = 0;
"wvous-tr-modifier" = 0
# or
$ defaults read com.apple.dock | grep modifier | sed -n -E 's/ "(.+)" = (.+);/\1=\2/p'
autohide-time-modifier="0.5"
wvous-bl-modifier=0
wvous-br-modifier=0
wvous-tr-modifier=0
Launchpad
enlarge icon
Copy # enlarge
$ defaults write com.apple.Dock springboard-rows -int 4
$ defaults write com.apple.Dock springboard-columns -int 4
# shrink
$ defaults write com.apple.Dock springboard-rows -int 10
$ defaults write com.apple.Dock springboard-columns -int 10
# reset
$ defaults delete com.apple.Dock springboard-rows
$ defaults delete com.apple.Dock springboard-columns
$ defaults write com.apple.Dock ResetLaunchPad -bool true
reset launchpad
Copy $ defaults write com.apple.dock ResetLaunchPad -bool true && killall Dock
# or
$ [ -e ~/Library/Application\ Support/Dock/*.db ] && rm ~/Library/Application\ Support/Dock/*.db
# revert back
$ defaults delete com.apple.dock springboard-rows
$ defaults delete com.apple.dock springboard-columns
$ defaults write com.apple.dock ResetLaunchPad -bool true && killall Dock
dashboard
disable dashboard
Copy # disable
$ defaults write com.apple.dashboard mcx-disabled -boolean YES && killall Dock
# enable
$ defaults write com.apple.dashboard mcx-disabled -boolean NO && killall Dock
keyboard remapping
[!NOTE|label:references:]
for filco minila air, enable dip switch 2, 5 and 6
2: change CapsLock and Esc
reset dns cache
[!NOTE|label:references:]
Copy $ sudo dscacheutil -flushcache && sudo killall -HUP mDNSResponder
MACOS VERSION COMMAND sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
sudo killall -HUP mDNSResponder
macOS 10.13 (High Sierra)
sudo killall -HUP mDNSResponder
sudo killall -HUP mDNSResponder
sudo killall -HUP mDNSResponder
sudo discoveryutil udnsflushcaches
sudo killall -HUP mDNSResponder
OS X 10.8 (Mountain Lion)
sudo killall -HUP mDNSResponder
sudo killall -HUP mDNSResponder
Mac OS X 10.6 (Snow Leopard)
sudo dscacheutil -flushcache
cursor
blink rate
Copy # 1000 = 1 sec
$ defaults write -g NSTextInsertionPointBlinkPeriodOn -float 200
$ defaults write -g NSTextInsertionPointBlinkPeriodOff -float 200
# revert
$ defaults delete -g NSTextInsertionPointBlinkPeriodOn
$ defaults delete -g NSTextInsertionPointBlinkPeriodOff
set standby
Copy # to 24 hours
$ sudo pmset -a standbydelay 86400
active dark mode
Copy $ defaults write -g NSRequiresAquaSystemAppearance -bool true
# logout and login
# revert
$ defaults write -g NSRequiresAquaSystemAppearance -bool false
automatic terminate inactive apps
Copy # disable
$ defaults write NSGlobalDomain NSDisableAutomaticTermination -bool true
# enable
$ defaults write NSGlobalDomain NSDisableAutomaticTermination -bool false
viewer windows mode
Copy # non-floating mode
$ defaults write com.apple.helpviewer DevMode -bool true
# floating mode
$ defaults write com.apple.helpviewer DevMode -bool false
textEdit
Copy # plain text mode
$ defaults write com.apple.TextEdit RichText -int 0
# revert
$ defaults delete com.apple.TextEdit RichText
# UTF-8 in TextEdit
$ defaults write com.apple.TextEdit PlainTextEncoding -int 4
$ defaults write com.apple.TextEdit PlainTextEncodingForWrite -int 4
disk utility
Copy # enable debug menu
$ defaults write com.apple.DiskUtility DUDebugMenuEnabled -bool true
$ defaults write com.apple.DiskUtility advanced-image-options -bool true
QuickTime
[!NOTE|label:references:]
auto-play
Copy # enable autostart movies
$ defaults write com.apple.QuickTimePlayerX MGPlayMovieOnOpen -bool true
# disable autostart movies
$ defaults delete com.apple.QuickTimePlayerX MGPlayMovieOnOpen
rounded corners
Copy # diable rounded corners
$ defaults write com.apple.QuickTimePlayerX MGCinematicWindowDebugForceNoRoundedCorners -bool true
# enable rounded corners
$ defaults delete com.apple.QuickTimePlayerX MGCinematicWindowDebugForceNoRoundedCorners
controller bar
Copy # disable controller bar
$ defaults write com.apple.QuickTimePlayerX MGUIVisibilityNeverAutoshow -bool true
# enable controller bar
$ defaults delete com.apple.QuickTimePlayerX MGUIVisibilityNeverAutoshow
auto show subtitles
Copy # enable auto show subtitles
$ defaults write com.apple.QuickTimePlayerX MGEnableCCAndSubtitlesOnOpen -bool true
# disable auto show subtitles
$ defaults delete com.apple.QuickTimePlayerX MGEnableCCAndSubtitlesOnOpen
App Store
Copy # enable the webkit developer tools
$ defaults write com.apple.appstore WebKitDeveloperExtras -bool true
# enable debug menu
$ defaults write com.apple.appstore ShowDebugMenu -bool true
# enable the automatic update check
$ defaults write com.apple.SoftwareUpdate AutomaticCheckEnabled -bool true
# check for software updates daily instead of weekly
$ defaults write com.apple.SoftwareUpdate ScheduleFrequency -int 1
# download newly available updates in background
$ defaults write com.apple.SoftwareUpdate AutomaticDownload -int 1
# install system data files & security updates
$ defaults write com.apple.SoftwareUpdate CriticalUpdateInstall -int 1
# automatically download apps purchased on other macs
$ defaults write com.apple.SoftwareUpdate ConfigDataInstall -int 1
# turn on app auto-update
$ defaults write com.apple.commerce AutoUpdate -bool true
# allow the app store to reboot machine on macos updates
$ defaults write com.apple.commerce AutoUpdateRestartRequired -bool true
activity monitor
Copy # show main window
$ defaults write com.apple.ActivityMonitor OpenMainWindow -bool true
# visualize cpu usage
$ defaults write com.apple.ActivityMonitor IconType -int 5
# show all processes
$ defaults write com.apple.ActivityMonitor ShowCategory -int 0
# sort via cpu usage
$ defaults write com.apple.ActivityMonitor SortColumn -string "CPUUsage"
$ defaults write com.apple.ActivityMonitor SortDirection -int 0
# update frequency
$ defaults write com.apple.ActivityMonitor "UpdatePeriod" -int "1" && killall Activity\ Monitor
# dock icon type
## 1: regular icon
$ defaults write com.apple.ActivityMonitor "IconType" -int "0" && killall Activity\ Monitor
## 2: show network usage over time
$ defaults write com.apple.ActivityMonitor "IconType" -int "2" && killall Activity\ Monitor
## 3: show disk usage over time, as two mirrored line graphs
$ defaults write com.apple.ActivityMonitor "IconType" -int "3" && killall Activity\ Monitor
## 5: show the current cpu usages, as a verticle meter.
$ defaults write com.apple.ActivityMonitor "IconType" -int "5" && killall Activity\ Monitor
## 6: show cpu usage history, graphed over time
$ defaults write com.apple.ActivityMonitor "IconType" -int "6" && killall Activity\ Monitor
over-the-top focus ring animation
Copy # disable
$ defaults write NSGlobalDomain NSUseAnimatedFocusRing -bool false
spotlight
Copy # disable
$ sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist
# enable
$ sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist
# [not recommended] hide icon
$ sudo chmod 600 /System/Library/CoreServices/Search.bundle/Contents/MacOS/Search
# stop indexing in a specific volume
$ sudo mdutil -i off "/Volumes/<name>"
# stop mdutil in a specific volume
$ sudo defaults write /.Spotlight-V100/VolumeConfiguration Exclusions -array "/Volumes/<name>"
change indexing order
Copy defaults write com.apple.spotlight orderedItems -array \
'{"enabled" = 1;"name" = "APPLICATIONS";}' \
'{"enabled" = 1;"name" = "SYSTEM_PREFS";}' \
'{"enabled" = 1;"name" = "DIRECTORIES";}' \
'{"enabled" = 1;"name" = "PDF";}' \
'{"enabled" = 1;"name" = "FONTS";}' \
'{"enabled" = 0;"name" = "DOCUMENTS";}' \
'{"enabled" = 0;"name" = "MESSAGES";}' \
'{"enabled" = 0;"name" = "CONTACT";}' \
'{"enabled" = 0;"name" = "EVENT_TODO";}' \
'{"enabled" = 0;"name" = "IMAGES";}' \
'{"enabled" = 0;"name" = "BOOKMARKS";}' \
'{"enabled" = 0;"name" = "MUSIC";}' \
'{"enabled" = 0;"name" = "MOVIES";}' \
'{"enabled" = 0;"name" = "PRESENTATIONS";}' \
'{"enabled" = 0;"name" = "SPREADSHEETS";}' \
'{"enabled" = 0;"name" = "SOURCE";}' \
'{"enabled" = 0;"name" = "MENU_DEFINITION";}' \
'{"enabled" = 0;"name" = "MENU_OTHER";}' \
'{"enabled" = 0;"name" = "MENU_CONVERSION";}' \
'{"enabled" = 0;"name" = "MENU_EXPRESSION";}' \
'{"enabled" = 0;"name" = "MENU_WEBSEARCH";}' \
'{"enabled" = 0;"name" = "MENU_SPOTLIGHT_SUGGESTIONS";}'
# Load new settings before rebuilding the index
killall mds > /dev/null 2>&1
# make sure indexing is enabled for the main volume
sudo mdutil -i on / > /dev/null
# rebuild the index from scratch
sudo mdutil -E / > /dev/null
crash reporter
Copy # disable
$ defaults write com.apple.CrashReporter DialogType none
notification center
Copy # disable
$ launchctl unload -w /System/Library/LaunchAgents/com.apple.notificationcenterui.plist && killall NotificationCenter
# enable
$ launchctl load -w /System/Library/LaunchAgents/com.apple.notificationcenterui.plist && killall NotificationCenter
time machine
Copy # disable dialog
$ defaults write com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool true
# or disable local backup
$ hash tmutil &> /dev/null && sudo tmutil disablelocal
scrollbars
Copy # always show
$ defaults write NSGlobalDomain AppleShowScrollBars -string "Auto"
rubber-band scrolling
Copy # disable
$ defaults write -g NSScrollViewRubberbanding -int 0
# enable
$ defaults delete -g NSScrollViewRubberbanding
airdrop
Copy # enable airdrop from ethernet
$ defaults write com.apple.NetworkBrowser BrowseAllInterfaces -bool true
ASCII control characters using caret notation in standard text views
[!NOTE|label:references:]
Copy $ defaults write NSGlobalDomain NSTextShowsControlCharacters -bool true
system-wide resume ( disable tab memory )
Copy # disable
$ defaults write NSGlobalDomain NSQuitAlwaysKeepsWindows -bool false
loginwindow
Copy # reveal ip address, hostname, os version, etc. when clicking the clock in the login window
$ sudo defaults write /Library/Preferences/com.apple.loginwindow AdminHostInfo HostName
# revert
$ sudo defaults delete /Library/Preferences/com.apple.loginwindow AdminHostInfo
sleep mode
Copy # never go to sleep mode
$ systemsetup -setcomputersleep Off > /dev/null
# disable computer sleep and stop the display from shutting off
$ sudo pmset -a sleep 0
$ sudo pmset -a displaysleep 0
# disable hibernatemode to speeds up entering sleep mode
$ sudo pmset -a hibernatemode 0
power button in stand-by mode
Copy # disable
$ defaults write com.apple.loginwindow PowerButtonSleepsSystem -bool no
# revert to original
$ defaults write com.apple.loginwindow PowerButtonSleepsSystem -bool yes
remove sleep image file
Copy $ sudo rm /Private/var/vm/sleepimage
# creating a zero-byte file instead of
$ sudo touch /Private/var/vm/sleepimage
# make sure be rewritten
$ sudo chflags uchg /Private/var/vm/sleepimage
download apps security
Copy # disable
$ defaults write com.apple.LaunchServices LSQuarantine -bool NO
# enable
$ defaults write com.apple.LaunchServices LSQuarantine -bool YES
un-useful sudden motion sensor for SSDs
Copy # disable
$ sudo pmset -a sms 0
smart quotes and smart dashes
Copy # disable
$ defaults write NSGlobalDomain NSAutomaticQuoteSubstitutionEnabled -bool false
$ defaults write NSGlobalDomain NSAutomaticDashSubstitutionEnabled -bool false
requiring password immediately
Copy $ defaults write com.apple.screensaver askForPassword -int 1
$ defaults write com.apple.screensaver askForPasswordDelay -int 0
subpixel font rendering
Copy # enable subpixel font rendering on non-Apple LCDs
$ defaults write NSGlobalDomain AppleFontSmoothing -int 2
HiDPI display modes
Copy $ sudo defaults write /Library/Preferences/com.apple.windowserver DisplayResolutionEnabled -bool true
$ sudo reboot
others
feedback assistant
auto gather
Copy # allow large
$ defaults write com.apple.appleseed.FeedbackAssistant Autogather -bool true
# not allow
$ defaults write com.apple.appleseed.FeedbackAssistant Autogather -bool false
sidecar on incompatible macs
Copy $ defaults write com.apple.sidecar.display AllowAllDevices -bool true;
$ defaults write com.apple.sidecar.display hasShownPref -bool true;
$ open /System/Library/PreferencePanes/Sidecar.prefPane
open photos automatically
Copy # disable
$ defaults -currentHost write com.apple.ImageCapture disableHotPlug -bool true
# revert back
$ defaults -currentHost delete com.apple.ImageCapture disableHotPlug
show one application at a time
Copy $ defaults write com.apple.dock single-app -bool true && killall Dock
# revert to orignial
$ defaults write com.apple.dock single-app -bool no && killall Dock
gatekeeper
Copy # disable
$ defaults write /Library/Preferences/com.apple.security GKAutoRearm -bool false
# revert to original
$ defaults delete /Library/Preferences/com.apple.security GKAutoRearm
music song notifications
Copy # show
$ defaults write com.apple.Music "userWantsPlaybackNotifications" -bool "false" && killall Music
confirm changes popup
Copy # disable
$ defaults write NSGlobalDomain "NSCloseAlwaysConfirmsChanges" -bool "true"
function keys behavior
Copy # default
$ defaults write NSGlobalDomain com.apple.keyboard.fnState -bool false
# setup
$ defaults write NSGlobalDomain com.apple.keyboard.fnState -bool true
disable Recent Items
[!NOTE|label:references:]
backup & restore
backup
Copy $ defaults export com.manytricks.Moom ~/Desktop/Moom.plist
restore
Copy $ defaults import com.manytricks.Moom ~/Desktop/Moom.plist
vscode
extension
backup
Copy $ code --list-extensions >> vs_code_extensions_list.txt
restore
Copy $ cat vs_code_extensions_list.txt | xargs -n 1 code --install-extension
settings
$HOME/Library/Application Support/Code/User/settings.json