1

I want to run a command line that opens a new chrome window with another profile.

I tested the following commands:

Preconditions:

  • I have two profiles: Profile 1 and Profile 2

  • Chrome is already running with Profile 1

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

The above command does nothing other than bringing focus to the currently running chrome with Profile 1

I also tried:

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

The effect is the same.

I want to run a command line that opens a new chrome window with Profile 2 while there is already a Chrome window running with Profile 1

3
  • 1
    Could you post the output of "/Applications/Google Chrome.app/Contents/MacOS/Chrome" --help ? The last part of Chrome can be something else too. you'd have to check. – anki Jul 15 '20 at 20:40
  • @ankii That's the answer actually :) I was using wrong profile name. I was using wrong command, too. I should have used "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" instead of open command – malhobayyeb Jul 15 '20 at 21:19
  • Nice to hear! please make an edit to ensure accuracy: apple.stackexchange.com/posts/396215/edit I don't use chrome or I'd have done that. @malhobayyeb – anki Jul 15 '20 at 21:55
1
+50

Pass the arguments to the Google Chrome's executable directly, instead of routing them via open --args.

Set an alias to the executable inside Chrome app. (right click > show package contents)

alias chrome_cli="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
chrome_cli --profile-directory="Profile 1" --new-window
chrome_cli --profile-directory="Profile 2" --new-window

Even append --new-window to the alias if that's used a lot.

For more help, run

chrome_cli --help

To remove alias,

unalias chrome_cli

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .