Skip to content

Instantly share code, notes, and snippets.

@kavyasukumar
Last active November 8, 2021 20:41
Show Gist options
  • Save kavyasukumar/a9605f56c4888ee963d1b6cdde31062c to your computer and use it in GitHub Desktop.
Save kavyasukumar/a9605f56c4888ee963d1b6cdde31062c to your computer and use it in GitHub Desktop.
Google Chrome Launcher

Google Chrome Launcher Apps

Instructions for creating Google Chrome Launcher Apps for differnt Chrome Profiles on MacOS

icons

See Tweet thread for context or read below.

Context

I have 7 Google Profiles that I actively switch between based on context. I like to keep them separate. It is both an attempt at separating the various sides of things as well as to avoid bloat by keeping extensions and history separate.

However, switching between profiles in Chrome is a collossal pain. Doubly so if you use services that use Google auth.

My needs were

  1. A quick way to launch Chrome in a particular profile
  2. Keep the launcher lightweight and make sure it does not interfere with any additional things I might want to do
  3. Visually diffrentiate the launchers

Solution

Create a launcher script to start Chrome in a particular profile. Add that as a shortcut.

I came across Platypus and decided to wrap the script as a MacOS app and give each launcher its own icon

Steps

  1. Create launcher script, say chromeLauncherProfile1.sh with the following line in it
open -na "Google Chrome" --args --profile-directory="Profile 1"

The -n is for new instance and -a is for app launching

Make sure the file is executable. Run chmod +x ./chromeLauncherProfile1.sh if needed

  1. Install Platypus and load the script from above in it. Choose Bash script option. Make sure you uncheck "Remain running after execution".

You can chose to have no interface for the launcher. I like to see immediate visual feedback so I use the progress bar view.

platypus screenshot

  1. Change icon to any image of your choice. I use a manipualted version of Chrome logo

Screen Shot 2020-05-03 at 1 16 55 PM

  1. Create app and add shortcut to dock or desktop Please note: this approach will also make it available in spotlight search. So name the app something meaningful

Finding Chrome profiles

Finding which profile is which is arguably the hardest part of this. The best way i have found is to look in the file structure to see where Chrome stores it.

On a standard installation of Chrome on MacOS, this is stored at ~/Library/Application Support/Google/Chrome/[Profile Name Folder]

cd ~/Library/Application\ Support/Google/Chrome/
cat Profile\ 1/Preferences | jq .account_info[0].email

This script will return the email associated with Profile 1

Note: You might have a profile folder called Default in addition to Profile 1, 2 etc.

#!/bin/bash
open -na "Google Chrome" --args --profile-directory="Profile 1"
#!/bin/bash
cd ~/Library/Application\ Support/Google/Chrome/
cat Profile\ 1/Preferences | jq .account_info[0].email
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment