Home > Mac administration, Mac OS X > Setting New Window and New Tab behavior in Safari

Setting New Window and New Tab behavior in Safari

While testing a new machine setup today, I noticed that Safari wasn’t opening to the default homepage like it should. Instead, it was opening Safari’s Top Sites.

Top Sites

There wasn’t an obvious way to set the Safari new window setting from the command line, but with the assistance of Greg Neagle, I’ve mapped out the applicable keys and their settings. See below the jump for the details.

The behavior of new Safari windows is set by the NewWindowBehavior key in /Users/username/Library/Preferences/com.apple.Safari.plist. Likewise, new Safari tabs are set by the NewTabBehavior key in /Users/username/Library/Preferences/com.apple.Safari.plist.

Both keys use an integer to set the desired behavior. Here’s how it maps out:

com.apple.Safari NewWindowBehavior

com.apple.Safari NewWindowBehavior 0 = Homepage

Screen Shot 2013-08-16 at 1.46.39 PM


com.apple.Safari NewWindowBehavior 1 = Empty Page

Screen Shot 2013-08-16 at 1.46.43 PM


com.apple.Safari NewWindowBehavior 2 = Same Page

Screen Shot 2013-08-16 at 1.46.45 PM


com.apple.Safari NewWindowBehavior 3 = Bookmarks

Screen Shot 2013-08-16 at 1.46.47 PM


com.apple.Safari NewWindowBehavior 4 = Top Sites

Screen Shot 2013-08-16 at 1.46.35 PM

com.apple.Safari NewTabBehavior

com.apple.Safari NewTabBehavior 0 = Homepage

Screen Shot 2013-08-16 at 1.46.22 PM


com.apple.Safari NewTabBehavior 1 = Empty Page

Screen Shot 2013-08-16 at 1.46.26 PM


com.apple.Safari NewTabBehavior 2 = Same Page

Screen Shot 2013-08-16 at 1.46.09 PM


com.apple.Safari NewTabBehavior 3 = Bookmarks

Screen Shot 2013-08-16 at 1.46.31 PM


com.apple.Safari NewTabBehavior 4 = Top Sites

Screen Shot 2013-08-16 at 1.46.19 PM

Here’s the defaults commands to set the NewWindowBehavior and NewTabBehavior keys to the various available settings:

Set new Safari windows to open to Safari’s default homepage:

defaults write com.apple.Safari NewWindowBehavior -int 0 

Set new Safari windows to open to an empty page:

defaults write com.apple.Safari NewWindowBehavior -int 1

Set new Safari windows to open to the same site as the last-opened page:

defaults write com.apple.Safari NewWindowBehavior -int 2

Set new Safari windows to open the Safari bookmarks page:

defaults write com.apple.Safari NewWindowBehavior -int 3

Set new Safari windows to open the Safari Top Sites page:

defaults write com.apple.Safari NewWindowBehavior -int 4

Set new Safari tabs to open to Safari’s default homepage:

defaults write com.apple.Safari NewTabBehavior -int 0

Set new Safari tabs to open to an empty page:

defaults write com.apple.Safari NewTabBehavior -int 1

Set new Safari tabs to open to the same site as the last-opened page:

defaults write com.apple.Safari NewTabBehavior -int 2

Set new Safari tabs to open the Safari bookmarks page:

defaults write com.apple.Safari NewTabBehavior -int 3

Set new Safari windows to open the Safari Top Sites page:

defaults write com.apple.Safari NewTabBehavior -int 4

  1. Gabe Shackney
    January 24, 2014 at 7:22 pm

    can this be scripted to write all users and the user template to store these as the default settings?

  2. September 17, 2014 at 10:16 pm

    # Set Safari Preferences.
    echo “Setting Safari to use CareyLink as home page”
    $defaults write “${USERPREFS_DIR}/com.apple.Safari” HomePage “http://www.google.com.au”
    $defaults write “${USERPREFS_DIR}/com.apple.Safari” ShowStatusBar -bool YES
    $defaults write “${USERPREFS_DIR}/com.apple.Safari” NewWindowBehavior -int 0
    $defaults write “${USERPREFS_DIR}/com.apple.Safari” NewTabBehavior -int 0

  1. No trackbacks yet.

Leave a comment