Tuesday, June 7, 2011

Using Multiple Google Accounts in Chrome

Now that I'm an employee of Google, I have two Google accounts, corporate and personal. Google has made it relatively easy to manage two accounts with "account switching". If I'm in Gmail, I can easily switch between accounts by clicking on my email address in the upper-right-hand corner of the screen, then selecting "switch account" followed by the account I want. But, the choice of account isn't completely persistent. Occasionally, I find that when Gmail and other Google applications switch users without any input from me. This seems to be especially common when I return to the computer after an extended break (e.g. overnight). One of the google applications will ask me to re-authenticate and this will screw-up the choice of account in other tabs. Also, it occasionally switches accounts on me when I click a link.

One obvious solution is two use two different browsers, e.g. Chrome for corporate and Firefox for personal. But, I feel that this is worse than the occasional random account switch that I get by using a single Chrome instance due to differences in the UI. A better solution seems to be separate profiles. Chrome allows you to specify the location for your user data. So, you can run two instances of Chrome, one with the default location and one with a custom location:

$ mkdir ~/.config/personal
$ google-chrome --user-data-dir=~/.config/personal
If you then use one account exclusively with each instance, there should never be any switching issues.