16

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??

2
  • What parts of the linked question did you try and what didn't work about them? May 28, 2014 at 4:26
  • 1
    'open -a "Google Chrome" --args --profile-directory=Default' Which in the same thread says this no longer works as of Nov 2014 Also tried 'com.google.Chrome --args --profile-directory=Default' After following his comment, tried it with it it hanging on that exact line, no erros, no chrome opening May 28, 2014 at 4:32

5 Answers 5

8

You could try the following:

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

Referred from this answer.

3
  • That was a thread i opened on stack overflow and they sent me here. that didn't work. --args --directory-profile="PROFILE_WANTED" Dosnt work for me :/ May 31, 2014 at 2:45
  • @igor what error do you get when you try to run it? May 10 at 17:03
  • @chirag64 sorry never mind, it is working, I confused it with another question
    – igor
    May 11 at 20:30
9

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.

3
  • What's the point of --args?
    – Pacerier
    Sep 8, 2017 at 14:31
  • 1
    @Pacerier per the man page for open: "--args: All remaining arguments are passed to the opened application in the argv parameter to main(). These arguments are not opened or interpreted by the open tool." In other words, we're specifying that --profile-directory is a switch for Chrome and not for open itself.
    – rymo
    Sep 8, 2017 at 15:59
  • 1
    Seems to open a new profile even when the name is right. Also tried using the full path to the profile and still getting a brand-new profile each time. Has something changed?
    – tgf
    Apr 24, 2019 at 16:17
2

To additionally pass a URL to open:

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

1
  • @communityBot As it’s currently written, your comment is unclear. Please edit to add additional details that will help me to understand what parts of my answer are unclear to you :P
    – Fer
    Mar 11, 2022 at 6:30
1

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

0
0

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"
1
  • As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
    – Community Bot
    Jun 15 at 19:56

You must log in to answer this question.

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