Tatsuhiko Miyagawa's Blog

Mac: Routing Links to Chrome Profiles

January 03, 2017

with Choosy and Google Chrome Canary

Assume you’re a Chrome user and have multiple Google profiles, one for your personal account and another for work account. This way you can sign in to sites like Google Apps, GitHub or Slack with the correct account.

The Problem

On Mac OS, Chrome profiles work under one Chrome app instance, which means when you click a link from other apps such as Mail, Twitter clients or Slack app, it will open in the last browser window you opened. This gets you into a situation where you click an internal Wiki link from Slack which opens in your personal profile window, which gets you redirected to your company’s SSO page (such as Okta) because you’re not signed in. Ugh! Now you go back to the other window to make sure it is forefront, then re-open the link. This is obviously tedious.

Solution

Enter Choosy: a browser shim that sends links to the right browser of your choice.

Choosy is designed for users who would like to open a particular link in a browser that’s different from the primary (default) browser.

Here’s the tricky bit: in my use case, there’s no non-default browsers involved. It’s both Google Chrome, just under a different profile, and the way Chrome User Profiles works is not really designed to operate under multiple Chrome instances.

It definitely seems possible to play with an AppleScript and then mess around URL handlers with plist files to create a separate Chrome app instance, but there’s a much easier way to get this done: Chrome Canary.

Unlike Chrome beta or dev channel, Chrome Canary operates as a complete separate app instance. This allows you to sign in to your personal account with primary Chrome, then to the work account with Chrome Canary, and they’re recognized as completely different browser applications by the system.

Now, all you need to do is to configure Choosy:

Rules to override Work link addressesYou can list as many enterprise/SaaS domains such as Okta, Zendesk, GitHub Enterprise and so on as an individual rule, and use “Any” to combine the rules.

As of this writing, the “Source application” setting seems to be kind of unreliable according to the developer. It is alright for me, since I use Slack for multiple teams and I do not want all links opened from Slack to go to my Work profile.

You can also add a modifier key such as Shift to force-enable or disable the particular override rules. I set it so that shift-clicking links in Slack always results to open in a work profile.

**Tip: **It is recommended to use one of Chrome themes to easily identify which browser profile you’re using. I chose the one that is similar to our corporate color scheme 😁