Always, 100% of the time, open tabs to the right of the current tab in Safari for macOS
Here's how you can fix the chronic pain in the neck New Tab behaviour in Safari for macOS, where there's no way at all for users to decide the position their new tabs should open at.
For new blank tabs
For new tabs opened from links
Open Terminal and run the following commands:
For new blank tabs
- Download Keyboard Cowboy [open source]
- Install and launch it
Once opened, in the leftmost panel…
- Under Configuration, leave it at Default Configuration
- Under Groups, click the barely visible Add Group button
- In the window that opens, set the name to Safari, then in the Application drop-down menu, select Safari, and finally click Save
- Make sure the Safari group is selected
In the middle panel…
- Under Workflows, click the barely visible Add Workflow button
In the rightmost panel…
- Set the workflow name to e.g. New tab
- Under Add Trigger, click the Keyboard Shortcut button
- Use command-T as the keyboard shortcut
- Click the New Command button and then in the popup menu, select Scripting and then New AppleScript
- Set name of the script to e.g. New tab script
- Click the Script goes here… field and paste the following
tell application "Safari" tell front window set _new to make new tab at after (get current tab) set _url to "x-safari-https://" # this url makes sure the 'New tabs/windows open with' settings are applied set URL of _new to _url repeat until URL of _new is not _url # wait until the tab gets a real url, or else the location bar won't be focused when switching to the new tab delay end repeat set current tab to _new end tell end tell
- Open Safari and test the keyboard shortcut
Optionally also…
- In the leftmost panel in Keyboard Cowboy go into every group and disable the factory-installed workflows, since some of them have keyboard shortcuts as triggers that you might not like
- To get rid of the dock icon, click the icon and then in the open Keyboard Cowboy window, press command-W or click the red close button in the top-left corner (don't press command-Q, or the background process too gets terminated)
- To make Keyboard Cowboy start automatically when you log in, click the menu bar icon and select Open at Login
- In case you don't fancy the menu bar icon, you can hold the command key and drag the icon as far as possible to the right so it gets out of sight
- In Safari, right-click the toolbar, choose Customize Toolbar… and drag the + icon out of the toolbar
For new tabs opened from links
Open Terminal and run the following commands:
defaults write com.apple.safari WBSNewTabPositionPreferenceKey -int 0
defaults write com.apple.safari WBSNewTabPositionAppliesToSpawnedTabsPreferenceKey -int 1
Then restart Safari (in case you haven't configured Safari to automatically reopen previous windows, click Reopen All Windows from Last Session under History in the menu bar)