How do I start Chrome using a specified "user profile"?

312,828

Solution 1

The command line argument you're looking for is --profile-directory=Default.

Here's the complete command line for Mac OS X:

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

Note: The open command therefore does not launch new instances, as many applications will not be able to deal with multiple instances running as the same user. However there's the -n argument to do that anyway, but it may break the application.

And for Linux:

google-chrome --profile-directory=Default

It expects the internal names of the profiles: My second profile, named "Lemonade" by Chrome, would be --profile-directory="Profile 1".

Determine the profile name by trial and error, or looking in the Local State file (see Justin Buser's answer).

On Mac OS X, the directories are located in ~/Library/Application Support/Google/Chrome. In Linux they are located in ~/.config/google-chrome. In Win7 they are located in %USERPROFILE%\AppData\Local\Google\Chrome\User Data.

Solution 2

GUI method with proper icon (for Windows)

  1. Type chrome://settings/ in address bar (or Menu > Settings)
  2. Select Customize your Chrome profile option
  3. Scroll to the bottom and toggle Create desktop shortcut

[1]:

Optional Switch to any other profile & repeat steps 1-4

This creates a shortcut icon to your profile with the correct picture in the icon too. You can drag multiple profiles to your Windows taskbar. The shortcut on Windows 7 icon points to

"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --profile-directory="Default"
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --profile-directory="Profile 1"
and so on...

Solution 3

Another, albeit less convenient method of choosing which profile will launch is to edit the Local State file in the Chrome User Data directory and search for "last_used": if you change the value it lists to a different Profile that's the one that will open the next time you launch chrome normally (unless of course you're using the switch mentioned above).

I only mention this in case anyone is interested in a more in-depth solution, that Local State file contains a JSON formatted list of settings that some might find useful.

Solution 4

--profile-directory is useless if you already have another profile opened or the last window you closed is attributed/was logged in with another profile.

I have app shortcuts with one profile. The apps shortcuts have --profile-directory="Profile 3" plus the --app="..

The default profile shortcut has --profile-directory="Default".

Both profiles get messed up. Extensions and the default shortcut that I use for daily browsing.

Solution 5

I've just tested this with 4 profiles with Chrome Version 22.0.1229.94 m:

Respectfully, I think the confusion is this:

  • If you close all instances of chrome and then launch Chrome with a simple chrome.exe without any switches, then this new instance that is launched will open with the profile of the very last Chrome window/instance that was closed.

  • If however, you click on a shortcut that you've created using the above --profile-directory method, an instance/window with the appropriate login regardless of which window(s)/ instances/ profiles are currently running, and/or which was the last one shutdown.

  • Share:
    312,828

    Related videos on Youtube

    Ryan
    Author by

    Ryan

    Updated on September 18, 2022

    Comments

    • Ryan
      Ryan almost 2 years

      I use the new built-in "Users" feature of Chrome to switch between Home/Work accounts easily. However, Chrome remembers the "last" user profile you had selected when launching new windows. This is a problem if I close down my "Home" profile last, because when I then click the Email shortcut on my taskbar, because it goes to mail.mycompany.com using my Home profile, and I'm not logged in.

      I'd like to change the shortcut to the company webmail to pass a switch that tells Chrome to always start as the "Default" user, regardless of the last one used.

      Note: I have tried the command-line parameter --user-data-dir=…, and this seems to do something very different, completely isolated from the Users functionality built in to Chrome. It's possible I'm using it wrong, but please test this before assuming it does the same thing and posting an answer ;-)

      • Synetech
        Synetech almost 12 years
      • Admin
        Admin almost 12 years
        For a Gmail shortcut in Windows: C:\Users\username\AppData\Local\Google\Chrome\Application\ch‌​rome.exe --profile-directory=Default --app=mail.google.com/mail/u/0
      • Aaron Thoma
        Aaron Thoma over 7 years
        The "user-data-directory" contains 1 or more "profile-directorys". The first one being Default, the second one (if existent) Profile 1, then Profile 2 (I assume) and so on. So the --profile-directory=Default parameter is relative to the user data directory by default (i.e. unless it starts e.g. with a drive letter: C:\MyChromeUserData\Default). Apart from the profiles, the user data directory contains little° useful data. When browsing the web on this topic, reckon with confusing inconsistent terminology for these 2 user/profile folder levels. // ° Footnote in next comment:
      • Aaron Thoma
        Aaron Thoma over 7 years
        Footnote for previous comment: ° probably not problematic to lose, e.g. in case you need to merge two of them; maybe the least unimportant data is the Local State file containing your choices whether Chrome should prompt for the application with which to open certain file types.
      • lessthanideal
        lessthanideal about 3 years
        None of the below solutions work for me. Warning: if you get the bright idea of renaming the profile directories (e.g. so the one you want chromium to consider last_used is always named Default), that also doesn't work, and also loses the bookmarks and some other settings from the profile you renamed to e.g. Default, so, don't try that... (using 90.0.4430.212 (Developer Build) built on Debian 10.9, running on Debian 10.9 (32-bit))
      • Sam Watkins
        Sam Watkins almost 3 years
        @lessthanideal please have a look right at the bottom of the page for my answer with some complete shell scripts that do work, created on Debian 11.
      • lessthanideal
        lessthanideal almost 3 years
        @SamWatkins Thanks a lot, that really helped me. It didn't quite work out of the box for my system but I was able to make a few tweaks and now it does -- I've posted my own answer with my version, giving credit to you and your answer of course :)
    • HikeMike
      HikeMike over 12 years
      @DannyTuppeny I got it from the source file after a few failed experiments. But you're right, googling for it is definitely difficult as everyone seems to use the other argument...
    • Ryan
      Ryan over 12 years
      I've had no issues - I just made sure all my shortcuts have the --profile-directory, so they'll all start with the profile I want :)
    • Justin Buser
      Justin Buser about 12 years
      I agree with Danny, you don't know what you're talking about. I have 6 profiles and a shortcut for each on my using this method and I can launch any or all of them regardless of whether or not chrome is already running.
    • Josh Hibschman
      Josh Hibschman almost 12 years
      @JustinBuser can you still do this in chrome 23? After chrome is open for me, I can't seem to launch a new window or change the profile with these switches.
    • interestinglythere
      interestinglythere over 10 years
      It's always a good idea to use a bundle identifier instead of the app name, as people sometimes rename their apps. (I renamed mine "Chrome" and the command above does open it at all.) open -b com.google.Chrome --args --profile-directory=Default
    • David P. Caldwell
      David P. Caldwell over 9 years
      As of 2015 Jan, this still does not work on OS X. One thing that does work is opening the application directly with the --profile-directory argument, even if the application is already running. So the problem isn't with the management of open windows so much as it is with how the Mac OS X open command interoperates with the application.
    • HikeMike
      HikeMike over 9 years
      @DavidP.Caldwell On OS X, an application generally only runs once. The open command therefore does not launch new instances, as many applications will not be able to deal with multiple instances running as the same user. There's the -n argument to do that anyway, but it may break the application (or be actively prevented by it).
    • Heinrich Hartmann
      Heinrich Hartmann over 8 years
      Does not work for Linux. No button "Add deskop shortcut"
    • user
      user over 8 years
      @HeinrichHartmann True, added Windows to the answer. Have to fallback on command line shortcuts for linux.
    • Brian Redbeard
      Brian Redbeard over 7 years
      Specifically the JSON object is .profile, thus if you have a tool like JQ you can even easily parse this out via: cat ~/.config/google-chrome/Local\ State | jq .profile to quickly see metadata on the profile like "user_name" (your Google Apps username for the profile), "name", etc.
    • Ryan
      Ryan over 7 years
      Your answer helped me in conjunction with these other answers: superuser.com/a/908108/74576 and superuser.com/a/997535/74576
    • user289394
      user289394 about 7 years
      An alternative, at least in win 10 pro, to dragging the newly created Chrome profile icon to the taskbar is to right click the desktop icon, then select "pin to taskbar" (unpin and re pin if already pinned). it seems the desktop icon reference to the programs file system is more promising than opening profiles and pinning all through the taskbar.
    • Pacerier
      Pacerier almost 7 years
      Why doesn't --args work for user data dir?
    • ϹοδεMεδιϲ
      ϹοδεMεδιϲ over 6 years
      Great ideas here; I have merged them all into a canned-solution. github.com/codemedic/bash-ninja/blob/master/gchrome
    • SpareBytes
      SpareBytes over 6 years
      This doesn't work when using the --user-data-dir flag
    • Keven
      Keven over 6 years
      On the current version of chrome (v65) there is now a toggle switch below the name and above the profile pictures with the words "Show desktop shortcut".
    • Gray
      Gray about 6 years
      This seems to be only in Windows, right?
    • yegle
      yegle over 5 years
      There's a super easy way to identify the profile directory: go to chrome://version and check the Profile Path. Assuming you are seeing /path/to/your/PROFILE, use --user-data-dir=/path/to/your --profile-directory=PROFILE. If your user data directory is the default location (the last paragraph in the answer) you can omit it.
    • John Lee
      John Lee almost 5 years
      I know the question is tagged as "command-line" but this pg came up in my searches so leaving a note for myself and others. As stated in comments, the Mac solution doesn't work for me to focus already opened profile. However, using keyboard shortcut superuser.com/a/954380/219323 works! I used hammerspoon to open Chrome then initiated a keyboard shortcut to switch to profile. hs.hotkey.bind({"cmd", "alt", "ctrl"}, "f9", function() hs.application.launchOrFocus("Google Chrome") hs.timer.doAfter(0.1, function() hs.eventtap.keyStroke("alt", "f9") end) end)
    • Ki Jéy
      Ki Jéy over 4 years
      Is it possible to pass it a full path (ie: a userDataDir used by a headless chromium build)
    • Slava Fomin II
      Slava Fomin II over 4 years
      There is no "Users" section on the settings page.
    • Stevoisiak
      Stevoisiak over 4 years
      There is no 'Users' section in Chrome v80.
    • callum
      callum over 3 years
      For me, this works, even when Chrome is already open with another profile: /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --profile-directory="Profile 1" (got the full application path from chrome://version
    • user
      user about 3 years
      @SlavaFominII Updated for recent chrome versions
    • lessthanideal
      lessthanideal about 3 years
      Didn't work for me, it seemed other parameters in that file (or somewhere else?) also affect it. Even copying & renaming the whole profile directories around (so e.g. the one I choose gets renamed to Default) also didn't work on my system, which seems to just want to refuse me doing this with any method.
    • lessthanideal
      lessthanideal about 3 years
      Doesn't work for me, even using yegle's solution in comments.
    • Sam Watkins
      Sam Watkins almost 3 years
      Using jq, we can get the profile keys and names like this: < ~/.config/google-chrome/Local\ State jq -r '.profile.info_cache|to_entries|map(.key + ": " + .value.name)|.[]' | sort -k2,2n
    • poleguy
      poleguy over 2 years
      "chrome_profiles_list" command worked great... but you didn't actually answer the question completely in this answer. But combined with the top rated answer, yours is gold.
    • Admin
      Admin about 2 years
      this is only true with open -a using this answer superuser.com/a/1677353/644627 does the trick even if chrome is already opened to another browser. another link that led to it working for myself: howchoo.com/macos/open-google-chrome-terminal-macos
    • Admin
      Admin about 2 years