Update 2015-09-25: clarify the term 'switch user' and emphasise that logout/login is not equivalent
Update 2015-04-18: updated bindfs command to use --xattr-none to avoid extended attribute problems when creating files using Finder
Update 2015-06-09: updated bindfs command to use -o volname="XYZ" to set a custom name for the mount (as opposed to the ugly default). With thanks to Dennis Jarvis for highlighting this

Installed on your Mac/PC, Google Drive allows you to sync files/folders (to use the terminology from the support page) with Google Drive on the web. That is to say for example, a Mac OS X user can connect his/her Google Drive account so that files/folders stored locally on the OS hard drive are automatically synced with the contents of Google Drive on the web.

Whilst it is possible to be signed into multiple Google accounts at once in a browser, with Google Drive on your Mac/PC it is only possible to be signed into one account at a time, i.e. you can only sync one account's files/folders at any given time. This is something of a restriction for those of us who have multiple accounts for genuine reasons, e.g. multiple work accounts and a personal account, where sharing across domains is either not possible/desirable, and where sync access to files from the same machine is desirable.

There are various solutions elsewhere on the web that variously talk about opening up permissions etc. but I could never truly get these to work (and to be honest the thought of chmod 777 on anything made me physically sick). Hence the alternative that I have laid out below.

WARNING

The following instructions have not be heavily road-tested, so please follow with caution. Use at your own risk, etc.

Let us assume:

  • We are using Yosemite (only tested under Yosemite, may well work under other versions of OS X)
  • The Mac OS X user who wants to connect and sync two Google Drive accounts is user_1
  • user_1 has access to both user_1@gmail.com (personal account) and user_1@work.com (Google Apps work account)
  • user_1 has followed the standard Google Drive setup to connect and sync user_1@gmail.com to "/Users/user_1/Google Drive"
  • user_1 wants to be able to connect and sync user_1@work.com to "/Users/user_1/Google Drive - work"

Steps

Let's assume you are already logged in as user_1

  1. Install FUSE for OS X
  2. Install Brew or update your existing install via brew update
  3. In a Terminal: brew install bindfs
  4. Create a new Mac OS X user called user_2
  5. Switch user (do not logout) to user_2
  6. In a Terminal: mkdir "$HOME/Google Drive" && chmod 700 "$HOME/Google Drive"
  7. Setup Google Drive as the user user_2 to connect user_1@work.com, syncing to /Users/user_2/Google Drive (the default)
  8. Let this sync complete
  9. Switch user back to user_1 (again, do not logout)
  10. In a Terminal: mkdir "/Users/user_1/Google Drive - work"
  11. In a Terminal: sudo bindfs -o volname="Google Drive - work" -o local --xattr-none --mirror=user_2,user_1,@staff --create-for-user=user_2 "/Users/user_2/Google Drive" "/Users/user_1/Google Drive - work"

With thanks to this link for the -o local fix

Done. This should now allow you to read/write/etc. files in "/Users/user_1/Google Drive - work" as user_1. These changes will get written as if you were user_2, which allows the Google Drive sync for user_2 (linked to user_1@work.com) to proceed as if the changes had been made by the user_2 Mac OS X user.

Conclusion

This approach appears to work and doesn't interfere with the normal operation of Google Drive for Mac OS X (it just thinks it's running for another user). However, this has not been heavily load/road tested.

The one thing that doesn't work is Spotlight indexing of the second Google Drive sync. You will notice above that we chmod 700 "/Users/user_2/Google Drive". This is important because otherwise user_1 may see the Spotlight search results from that directory (by default this shouldn't be the case, but we chmod 700 to be sure), as opposed to the FUSE mount at "/Users/user_1/Google Drive - work". Unfortunately I haven't found a way to make Spotlight index the FUSE mount for user_1 (comments/thoughts welcomed).

One thing you will need to remember, if you restart your computer you need to:

  1. Switch user to user_2 to ensure Google Drive is running (should start by default on login)
  2. Perform the sudo bindfs ... step above once you have logged in as user_1, else "/Users/user_1/Google Drive - work" will be empty

Comments/thoughts on this approach welcomed below.