Open URL with Google Chrome from command-line with a specific profile
How to open an URL with Google Chrome from command-line with a specific profile?
I've so far come up with the following but the --args --profile-directory="Profile 22"
part does not seem to pass the argument to Google Chrome:
open -a 'Google Chrome' https://www.bing.com --args --profile-directory="Profile 22"
The -g
option is intended to not bring the Google Chrome window immediately to the foreground. C.f. the documentation for open
:
-g Do not bring the application to the foreground.
The following does work, but I'm trying to avoid using specific full path for Google Chrome:
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --args --profile-directory="Profile 22" 'https://www.bing.com'
Solution 1:
You can use. e.g.:
open -na 'Google Chrome' --args --profile-directory="Profile 22" 'https://www.bing.com'
However, not with the -g
option.
The -n
option is used to ensure opening the given profile if another profile already has a window open.