18

I have been trying to open Google Chrome from command line but with no luck! I have tried How do I start Chrome using a specified "user profile"?

My goal is to open Google Chrome with a specific profile such as "profile 1", "profile 2", or "Default" from the command line, using bash to be specific, on my Mac.

UPDATE: 6/3/14 Got this to work BUT only works when opening chrome for the first time

open -a Google\ Chrome --args --"profile-directory"="Profile 1"

So How do you get --args to be accepted AFTER google chrome as already been launched??

5 Answers5

10

To force a new profile window after Chrome has been launched:

open -n -a "Google Chrome" --args --profile-directory="<your profile>"

(where <your profile> is one of the Profile nn folder names found in ~/Library/Application Support/Google/Chrome/)

According to the manpage for open, the -n flag forces "a new instance of the application even if one is already running." You'll see second Chrome icon flash open briefly in the dock while the window loads but everything runs normal after that.

rymo
  • 1,108
9

You could try the following:

/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --args --profile-directory=Default

Referred from this answer.

2

To additionally pass a URL to open:

open -n -a "Google Chrome" --args https://example.com --profile-directory="Profile 5"

Fer
  • 121
1

Try: open -a "Google Chrome" --args --profile-directory=<your profile name> Works every time for me.

1

chrome profile names in the browser UI and their profile folder names are different.

# eg: default profile name in UI might be "Abc", but its profile name is Default
# eg: another profile name in UI might be "Test Account", but its profile name might be "Profile 1"
# so identify the profiles names properly at ~/Library/Application\ Support/Google/Chrome

open -n -a "Google Chrome.app" --args --profile-directory="Profile 2"

Venu
  • 111