Create a terminal command to open another user profile in chrome [duplicate]

How can I create a terminal command to open another user's profile in Chrome?

It takes me a long time to switch between them because I have a lot of users in Chrome.


Solution 1:

Testing with Google Chrome (85.0.4183.102), the following command in Terminal works for me:

open -na 'Google Chrome' --args --profile-directory="$PROFILE"
  • Where $PROFILE is the name of the profile you want to open, e.g. "Default", "Profile 1", "Profile 2", etc.
  • Note: The $PROFILE is the name of each folder for each user in: ~/Library/Application Support/Google/Chrome/
  • In Google Chrome if you open a tab to chrome://version/ and look at Profile Path:, you'll see which profile folder belongs to the user who's profile you are current logged in as.

If you want to get details of each profile, you can use the third-party utility jq to parse the ~/Library/Application Support/Google/Chrome/Local State file in Terminal, e.g.:

jq .profile ~/Library/Application\ Support/Google/Chrome/Local\ State

You can then look at the output for e.g. "Default", "Profile 1", "Profile 2", etc. and under each profile you'll see info for e.g. "gaia_given_name":, "gaia_name":, "name": or "user_name": to ascertain which profile belongs to whom.

I downloaded jq from https://stedolan.github.io/jq/ and it was saved a jq-osx-amd64 in my Downloads folder. I renamed it to jq, made it executable with chmod +x jq and moved it to /usr/local/bin/ so it would be available in my PATH.