Skip to content

Instantly share code, notes, and snippets.

@khsing
Last active June 24, 2024 20:35
Show Gist options
  • Save khsing/6697187 to your computer and use it in GitHub Desktop.
Save khsing/6697187 to your computer and use it in GitHub Desktop.
some hacks for mac
#!/bin/bash
# curl -skL https://gist.github.com/khsing/6697187/raw/mactips.sh | bash
# "Enable full keyboard access for all controls (e.g. enable Tab in modal dialogs)"
defaults write NSGlobalDomain AppleKeyboardUIMode -int 3
# Allow Finder quit.
defaults write com.apple.finder QuitMenuItem -bool true
echo "Allow quitting Finder via ⌘ + Q; doing so will also hide desktop icons"
defaults write com.apple.finder QuitMenuItem -bool true
# Disable window animations and Get Info animations in Finder
# defaults write com.apple.finder DisableAllAnimations -bool true
echo "Show all filename extensions in Finder"
defaults write NSGlobalDomain AppleShowAllExtensions -bool true
echo "Use current directory as default search scope in Finder"
defaults write com.apple.finder FXDefaultSearchScope -string "SCcf"
echo "Show Path bar in Finder"
defaults write com.apple.finder ShowPathbar -bool true
echo "Show Status bar in Finder"
defaults write com.apple.finder ShowStatusBar -bool true
echo "Expand save panel by default"
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true
echo "Expand print panel by default"
defaults write NSGlobalDomain PMPrintingExpandedStateForPrint -bool true
echo "Disable the “Are you sure you want to open this application?” dialog"
defaults write com.apple.LaunchServices LSQuarantine -bool false
echo "Enable AirDrop over Ethernet and on unsupported Macs running Lion"
defaults write com.apple.NetworkBrowser BrowseAllInterfaces -bool true
echo "Display full POSIX path as Finder window title"
defaults write com.apple.finder _FXShowPosixPathInTitle -bool true
echo "Avoid creating .DS_Store files on network volumes"
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
echo "Disable the warning when changing a file extension"
defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false
echo "Disable Safari’s thumbnail cache for History and Top Sites"
defaults write com.apple.Safari DebugSnapshotsUpdatePolicy -int 2
echo "Enable Safari’s debug menu"
defaults write com.apple.Safari IncludeInternalDebugMenu -bool true
echo "Make Safari’s search banners default to Contains instead of Starts With"
defaults write com.apple.Safari FindOnPageMatchesWordStartsOnly -bool false
echo "Only use UTF-8 in Terminal.app"
defaults write com.apple.terminal StringEncodings -array 4
echo "Make ⌘ + F focus the search input in iTunes"
defaults write com.apple.iTunes NSUserKeyEquivalents -dict-add "Target Search Field" "@F"
echo "Disable the “reopen windows when logging back in” option"
# This works, although the checkbox will still appear to be checked.
defaults write com.apple.loginwindow TALLogoutSavesState -bool false
defaults write com.apple.loginwindow LoginwindowLaunchesRelaunchApps -bool false
echo "Show the ~/Library folder"
chflags nohidden ~/Library
#This disable shadow when capture a window
defaults write com.apple.screencapture disable-shadow -bool true
killall SystemUIServer
echo "Disable local Time Machine backups"
hash tmutil &> /dev/null && sudo tmutil disablelocal
echo "Change Default Simplied Chinese font fallback"
plutil -convert xml1 -o - /System/Library/Frameworks/ApplicationServices.framework/Frameworks/CoreText.framework/Resources/DefaultFontFallbacks.plist | sed 's/STKaiti/STKaiti-SC-Regular/g;s/STSong/STSongti-SC-Regular/g;s/STHeitiSC-Light/HiraginoSansGB-W3/g' | sudo plutil -convert binary1 -o /System/Library/Frameworks/ApplicationServices.framework/Frameworks/CoreText.framework/Resources/DefaultFontFallbacks.plist -
echo "Display system stats, such as OS version and build number, IP address."
sudo defaults write /Library/Preferences/com.apple.loginwindow AdminHostInfo HostName
echo "If Path Finder is installed, set default Finder as Path Finder"
if [ -d "/Applications/Path Finder.app" ];then
defaults write com.apple.loginwindow Finder /Applications/Path\ Finder.app
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment