Open new Chrome window with different profile from command line
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
andProfile 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
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
- https://unix.stackexchange.com/questions/3773/how-to-pass-parameters-to-an-alias