3

I am new to Mac, and I have my rough time (missing keys, wrong shortcuts and etc). But I don't give up. I am a JS developer with more than 10 years of Windows and Linux (Debian, Ubuntu) experience and I need another Chrome profile accessible on a demand. The easiest way for me is another icon in Dock (and on the desktop). It is very easy in Windows - one just have to make shortcut and enter command line for chrome which looks like this: google-chrome --profile-directory=Default

For OS X I found command line is

open -a "Google Chrome" --args --profile-directory=Default

How to make a shortcut in Dock and on Desktop using it?

Please mind the subject (question), it is important for me, that shortcuts has to allow running multiple profiles simultaneously. I didn't stated it first time, because it was obvious for me it will work that way (Linux and Windows just do it).

2

Since there are several possible answers, I will introduce a more exotic one:

  • Download and install Platypus

  • Create a file chromedefault.sh in ~/Documents/scripts/ with the content:

    #!/bin/bash
    open -a "Google Chrome" --args --profile-directory=Default
    
  • Open Platypus with the following settings:

    enter image description here

    and create a new "app" ChromeDefault.

  • For a second app with the profile Other use another script chromeother.sh with appropriate changes:

    #!/bin/bash
    open -a "Google Chrome" --args --profile-directory=Other
    

    and call it ChromeOther.

  • Put both apps in the /Applications folder and create as many symlinks or aliases as needed.
  • 1
    I have a problem with this solution, when Chrome runs Default profile running command open -a "Google Chrome" --args --profile-directory=Other makes only current Chrome window focus. How to run two or more profiles simultaneously? – Marecky Nov 18 '15 at 10:41
1

Open Script Editor from /Application/Utilities >> create a new doc >> paste following:

do shell script "/Applications/Google\\ Chrome.app/Contents/MacOS/Google\\ Chrome --profile-directory=Profile\\ 3 > /dev/null 2>&1 &"

FYI:

\\ contains a space (the first back slash escapes the second back slash which escapes the space!);

and user profile ../Chrome/Profile 3 will be --profile-directory=Profile\\ 3 in the code, ../Chrome/Profile 2 will be --profile-directory=Profile\\ 2, ../Chrome/Default will be --profile-directory=Default

Try to run it and save it if it works.

  • double '\' seems couldn't show, idk y.. it show be \\ – Vlade Jun 1 '16 at 8:26
  • do shell script "/Applications/Google\\ Chrome.app/Contents/MacOS/Google\\ Chrome --profile-directory=Profile\\ 3 > /dev/null 2>&1 &" – Vlade Jun 1 '16 at 8:27
0

Building on klanomath's answer, I wrote the following shell script:

#! /usr/local/bin/zsh

declare -a profiles=( "Default" "Profile 3" "Profile 4" )
declare -a profile_aliases=( one two three )

if [ -z $1 ]; then
    exit
fi

for n ({1..${#profile_aliases}}); do
    if [ $profile_aliases[$n] = $1 ]; then
        #echo $profiles[$n];
        /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --new-window --profile-directory="${profiles[$n]}"
    fi
done

this enables you to run ./chrome.sh one, which will launch the Default folder. The main difference in this and the other solutions here is the --new-window switch, which makes Chrome run in a new window. Also, I'm just using the Google Chrome executable, which just made sense to me.

-2

just use the Automater app. its built into macOS to make the shell script into am app.

We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.

  • Welcome to Ask Different and thank you for your answer. :) Unfortunately, short answers such as this don't really provide enough detail or context to help many users. If possible, it'd be good if you could add some more info on such as how a user would use the Automator app to do what you're suggesting? Also, you may want to read How to Answer for tips on providing answers here. – Monomeeth May 8 '18 at 23:45

You must log in to answer this question.

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