Google Chrome is my de facto desktop browser, but its latest update (v68.0.3440.75, to be exact) fixed a bug that has really been more of a feature to me (and as it turns out, a number of others). Before this update, any external link outside of Chrome would be opened as a new tab in Chrome’s “last active window” — if you were browsing in Incognito mode, it would open any link you click outside of Chrome, assuming you have Chrome set as your default browser, in a new tab under the same Incognito window you’d been using.

I’ve grown to love this neat little feature, and this “bug” has been around for so long that it is probably what got me into the habit of keeping my browsing history minimal and essential, i.e. ideally it should contain only sites that are worth revisiting, not a page to unsubscribe from newletters I never really wanted to “subscribe” in the first place, for example.

Here is a workaround I’ve found: create an AppleScript (like the one below), save it as an Application, register it as a handler of http and https schemes, set this as the default browser, and voila!

on run theURL
	tell application "Google Chrome"
		if application "Google Chrome" is not running then
			close window 1
		end if
		make new window with properties {mode:"incognito"}
		tell its window 1
			set URL of tab 1 to theURL
		end tell
	end tell
end run

Now, if you don’t really want to deal with all this, here’s an even simpler way—just download this zipped, unzip the to your /Applications/ folder, and set it as the default web browser.

If you are on macOS Sierra or later, you might need to disable the Gatekeeper with:

sudo spctl --master-disable

Hey, kudos for making it this far! If you've liked this, you might also like tmux Cheatsheet and Shortcuts.