Useful macOS defaults: Safari
com.apple.Safari controls how Safari looks and behaves. Many of these settings are not in the Safari Settings window and can only be changed through the command line.
After changing these, quit and reopen Safari.
Developer menu
Show the Develop menu in the menu bar:
defaults write com.apple.Safari IncludeDevelopMenu -bool trueThis gives you access to the Web Inspector, the JavaScript console, the responsive design mode, and other developer tools.
Enable the Web Inspector in all web views across macOS (not just Safari):
defaults write NSGlobalDomain WebKitDeveloperExtras -bool trueDebug menu
Show the hidden Debug menu:
defaults write com.apple.Safari IncludeInternalDebugMenu -bool trueThis adds an extra menu with tools for testing and troubleshooting Safari.
Search
Show the full URL in the address bar instead of just the domain name:
defaults write com.apple.Safari ShowFullURLInSmartSearchField -bool trueSet the default search engine. The values are not the engine names but internal codes. It is easier to change this in Safari Settings.
Tab behaviour
Open new tabs and windows with an empty page instead of your homepage or favourites:
defaults write com.apple.Safari NewTabBehavior -int 1
defaults write com.apple.Safari NewWindowBehavior -int 1Values:
0= homepage1= empty page2= same page as current tab3= bookmarks4= top sites or start page
Press Tab to highlight each item on a web page
By default, pressing Tab in Safari moves between text fields and dropdowns only. To make Tab step through all links and buttons too:
defaults write com.apple.Safari WebKitTabToLinksPreferenceKey -bool true
defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2TabsToLinks -bool truePrivacy and tracking
Block all cookies:
defaults write com.apple.Safari BlockStoragePolicy -int 2Values:
1= block cookies from third parties only2= block all cookies3= allow all cookies
Send a "Do Not Track" header with every request:
defaults write com.apple.Safari SendDoNotTrackHTTPHeader -bool trueTurn off Safari Suggestions in the address bar (stops queries being sent to Apple):
defaults write com.apple.Safari UniversalSearchEnabled -bool false
defaults write com.apple.Safari SuppressSearchSuggestions -bool trueTurn off preloading the top search result in the background:
defaults write com.apple.Safari PreloadTopHit -bool falseAutoFill
Turn off AutoFill for different types of data:
defaults write com.apple.Safari AutoFillFromAddressBook -bool false
defaults write com.apple.Safari AutoFillPasswords -bool false
defaults write com.apple.Safari AutoFillCreditCardData -bool false
defaults write com.apple.Safari AutoFillMiscellaneousForms -bool falseWarnings
Turn off the warning when visiting a website that is possibly fraudulent:
defaults write com.apple.Safari WarnAboutFraudulentWebsites -bool falseOnly turn this off if you have a good reason. It protects you from phishing sites.
Plugins and JavaScript
Allow JavaScript (on by default):
defaults write com.apple.Safari WebKitJavaScriptEnabled -bool true
defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2JavaScriptEnabled -bool trueBlock pop-up windows:
defaults write com.apple.Safari WebKitJavaScriptCanOpenWindowsAutomatically -bool false
defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2JavaScriptCanOpenWindowsAutomatically -bool falseDownloads
Set the download location:
defaults write com.apple.Safari DownloadsPath -string "~/Downloads"Open "safe" files after downloading (like PDFs and images). To stop this:
defaults write com.apple.Safari AutoOpenSafeDownloads -bool falseRemove download list items. Options are after downloading successfully, manually, or after one day:
defaults write com.apple.Safari DownloadsClearingPolicy -int 2Values:
0= manually1= after one day2= after downloading successfully
Status bar
Show the status bar at the bottom of the window (shows link URLs when you hover):
defaults write com.apple.Safari ShowOverlayStatusBar -bool trueFavicons in tabs
Show website icons in tabs:
defaults write com.apple.Safari ShowIconsInTabs -bool trueBackspace to go back
Let the Delete key go back to the previous page:
defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2BackspaceKeyNavigationEnabled -bool trueCompact tab layout
Use the compact tab bar (address bar merged with tabs):
defaults write com.apple.Safari ShowStandaloneTabBar -bool falseUse the separate tab bar (address bar on its own line):
defaults write com.apple.Safari ShowStandaloneTabBar -bool trueClear browsing data
You can clear browsing history from the command line, though this is less common as a default:
# Clear history (use with care)
defaults delete com.apple.Safari RecentSearchStringsRead all current Safari settings
defaults read com.apple.SafariThe output is long. You can filter it:
defaults read com.apple.Safari | grep -i "search"Notes
Some Safari settings need two keys because Safari uses two web rendering paths (the older WebKit preferences and the newer WebKit2 preferences). When you see both WebKit and WebKit2 versions of a setting, set both to be safe.
Safari is sandboxed, so some defaults may not take effect until you quit and reopen it. If a setting does not seem to work, try logging out and back in.
Enjoyed this post?
Well, you could share the post with others, follow me with RSS Feeds and/or send me a comment via email.
Tags
Category:
Tags:
Year: