2

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

2
  • 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, 2020 at 20:40
  • 1
    @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 Jul 15, 2020 at 21:19

1 Answer 1

6
+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
1
  • spaces need to be escaped. alias chrome_cli="/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome"
    – kaoson g
    Aug 22, 2022 at 9:22

You must log in to answer this question.

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