blob: b5cb115586972b0c87d85aa26d482427f7aabe0a [file] [log] [blame] [view]
Steve Kobes22fb19c2017-07-05 21:49:081# User Data Directory
2
3[TOC]
4
5## Introduction
6
7The user data directory contains profile data such as history, bookmarks, and
8cookies, as well as other per-installation local state.
9
10Each [profile](https://support.google.com/chrome/answer/2364824) is a
11subdirectory (often `Default`) within the user data directory.
12
13## Current Location
14
15To determine the user data directory for a running Chrome instance:
16
171. Navigate to `chrome://version`
182. Look for the `Profile Path` field. This gives the path to the profile
19 directory.
203. The user data directory is the parent of the profile directory.
21
22Example (Windows):
23
24* [Profile Path] `C:\Users\Alice\AppData\Local\Google\Chrome\User Data\Default`
25* [User Data Dir] `C:\Users\Alice\AppData\Local\Google\Chrome\User Data`
26
27## Default Location
28
29The default location of the user data directory is computed by
30[`chrome::GetDefaultUserDataDirectory`](https://cs.chromium.org/chromium/src/chrome/common/chrome_paths_internal.h?q=GetDefaultUserDataDirectory).
31
32Generally it varies by
33
34* OS platform,
35* branding ([Chrome vs. Chromium](chromium_browser_vs_google_chrome.md), based
36 on `is_chrome_branded` in [GN
37 args](https://www.chromium.org/developers/gn-build-configuration)), and
38* [release channel](https://www.chromium.org/getting-involved/dev-channel)
39 (stable / beta / dev / canary).
40
41### Windows
42
43The default location is in the local app data folder:
44
45* [Chrome] `%LOCALAPPDATA%\Google\Chrome\User Data`
Raymond Toy4e6608072021-04-15 21:38:2646* [Chrome Beta] `%LOCALAPPDATA%\Google\Chrome Beta\User Data`
Andrew Williams1f2119b2025-09-12 15:09:0747* [Chrome Dev] `%LOCALAPPDATA%\Google\Chrome Dev\User Data`
Steve Kobes22fb19c2017-07-05 21:49:0848* [Chrome Canary] `%LOCALAPPDATA%\Google\Chrome SxS\User Data`
Peter Kvitekb21d6202024-10-04 12:06:0449* [Chrome for Testing] `%LOCALAPPDATA%\Google\Chrome for Testing\User Data`
Steve Kobes22fb19c2017-07-05 21:49:0850* [Chromium] `%LOCALAPPDATA%\Chromium\User Data`
51
Andrew Williams1f2119b2025-09-12 15:09:0752(The channel suffix is determined using
Steve Kobes22fb19c2017-07-05 21:49:0853[`InstallConstants::install_suffix`](https://cs.chromium.org/chromium/src/chrome/install_static/install_constants.h?q=install_suffix).)
54
55### Mac OS X
56
57The default location is in the `Application Support` folder:
58
59* [Chrome] `~/Library/Application Support/Google/Chrome`
Raymond Toy4e6608072021-04-15 21:38:2660* [Chrome Beta] `~/Library/Application Support/Google/Chrome Beta`
Andrew Williams1f2119b2025-09-12 15:09:0761* [Chrome Dev] `~/Library/Application Support/Google/Chrome Dev`
Steve Kobes22fb19c2017-07-05 21:49:0862* [Chrome Canary] `~/Library/Application Support/Google/Chrome Canary`
Peter Kvitekb21d6202024-10-04 12:06:0463* [Chrome for Testing] `~/Library/Application Support/Google/Chrome for Testing`
Steve Kobes22fb19c2017-07-05 21:49:0864* [Chromium] `~/Library/Application Support/Chromium`
65
Andrew Williams1f2119b2025-09-12 15:09:0766(The channel suffix is determined using the `CrProductDirName` key in the
Steve Kobes22fb19c2017-07-05 21:49:0867browser app's `Info.plist`.)
68
69### Linux
70
71The default location is in `~/.config`:
72
73* [Chrome Stable] `~/.config/google-chrome`
74* [Chrome Beta] `~/.config/google-chrome-beta`
75* [Chrome Dev] `~/.config/google-chrome-unstable`
Andrew Williams1f2119b2025-09-12 15:09:0776* [Chrome Canary] `~/.config/google-chrome-canary`
Peter Kvitekb21d6202024-10-04 12:06:0477* [Chrome for Testing] `~/.config/google-chrome-for-testing`
Steve Kobes22fb19c2017-07-05 21:49:0878* [Chromium] `~/.config/chromium`
79
Andrew Williams1f2119b2025-09-12 15:09:0780(The beta, dev, and canary channel suffixes are determined from
81`$CHROME_VERSION_EXTRA`, which is passed by the
82[launch wrapper script](https://cs.chromium.org/chromium/src/chrome/installer/linux/common/wrapper?q=CHROME_VERSION_EXTRA).)
Steve Kobes22fb19c2017-07-05 21:49:0883
84The `~/.config` portion of the default location can be overridden by
85`$CHROME_CONFIG_HOME` (since M61) or by `$XDG_CONFIG_HOME`.
86
87Note that `$XDG_CONFIG_HOME` affects all applications conforming to the
88[XDG Base Directory Spec](https://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html),
89while `$CHROME_CONFIG_HOME` is specific to Chrome and Chromium.
90
91### Chrome OS
92
93The default location is: `/home/chronos`
94
95### Android
96
97The default location comes from
Steve Kobes49666412017-07-06 01:02:4998[Context.getDir](https://developer.android.com/reference/android/content/Context.html#getDir%28java.lang.String,%20int%29)
Steve Kobes22fb19c2017-07-05 21:49:0899and is specific to the app.
100
101Example: `/data/user/0/com.android.chrome/app_chrome`
102
103### iOS
104
105The default location is inside the application support directory in the app
106sandbox.
107
108* [Chrome] `Library/Application Support/Google/Chrome`
109* [Chromium] `Library/Application Support/Chromium`
110
111## Overriding the User Data Directory
112
113### Command Line
114
Zhaoyang Lif632baa2021-08-06 16:33:01115On most platforms, the user data directory can be overridden by passing the
Steve Kobes22fb19c2017-07-05 21:49:08116`--user-data-dir` command-line flag to the Chrome binary.
117
Zhaoyang Lif632baa2021-08-06 16:33:01118The override happens in `chrome/app/chrome_main_delegate.cc`. Platforms not
119building with the file may not have implemented the override. Overriding the
120user data directory via the command line is not supported on iOS.
121
Steve Kobes22fb19c2017-07-05 21:49:08122Example:
123
124* [Windows] `chrome.exe --user-data-dir=c:\foo`
125* [Linux] `google-chrome --user-data-dir=/path/to/foo`
126
127### Environment (Linux)
128
129On Linux, the user data directory can also be overridden with the
130`$CHROME_USER_DATA_DIR` environment variable.
131
132The `--user-data-dir` flag takes precedence if both are present.
133
134### Chrome Remote Desktop sessions (Linux)
135
Yuwei Huang6c8d6ad2022-08-02 21:25:25136[Chrome Remote
137Desktop](https://support.google.com/chrome/answer/1649523) (CRD) used to set
138`$CHROME_USER_DATA_DIR` or `$CHROME_CONFIG_HOME` on the virtual session on a
139Linux host, since a single Chrome instance cannot show windows on multiple X
140displays, and two running Chrome instances cannot share the same user data
141directory. However, with the obsolescence of `dbus-x11`, most modern Linux
142distros have lost the ability to simultaneously run multiple graphical sessions
143for the same user without running into difficult-to-trace dbus cross talk
144issues, and Chrome can only be run on a single X display per user in reality.
145Therefore, CRD no longer sets these environment variables for new installations
146after CRD host M105.
Steve Kobes22fb19c2017-07-05 21:49:08147
Yuwei Huang6c8d6ad2022-08-02 21:25:25148The CRD host will continue to set these environment variables if either
149`chrome-config/` or `chrome-profile/` exists in
150`~/.config/chrome-remote-desktop/`. If you want to use the local Chrome profile
151in CRD sessions, quit Chrome and delete these folders from
152`~/.config/chrome-remote-desktop/`, then reboot the host device.
Steve Kobes22fb19c2017-07-05 21:49:08153
154### Writing an AppleScript wrapper (Mac OS X)
155
156On Mac OS X, you can create an application that runs Chrome with a custom
157`--user-data-dir`:
158
1591. Open Applications > Utilities > Script Editor.
160
1612. Enter:
162
163```
164set chrome to "\"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome\""
165set userdatadir to "\"$HOME/Library/Application Support/Google/Chrome Alt\""
166do shell script chrome & " --user-data-dir=" & userdatadir & " > /dev/null 2>&1 &"
167```
168
1693. Modify as needed for your installation path, Chrome versus Chromium, and
170 desired user data directory.
171
1724. Save the script in your Applications directory with the file format
173 "Application".
174
1755. Close the Script Editor, find your newly created application, and run it.
176 This opens a Chrome instance pointing to your new profile.
177
178If you want, you can give this application the same icon as Chrome:
179
1801. Select the Google Chrome application and choose File > Get Info.
1812. Select the icon at the top left of the info dialog. You will see a blue
182 highlight around the icon.
1833. Press ⌘C to copy the icon.
1844. Open the info dialog for the new application and select the icon in the
185 top left.
1865. Press ⌘V to paste the copied icon.
187
188## User Cache Directory
189
190On Windows and ChromeOS, the user cache dir is the same as the profile dir.
191(The profile dir is inside the user data dir.)
192
193On Mac OS X and iOS, the user cache dir is derived from the profile dir as
194follows:
195
1961. If `Library/Application Support` is an ancestor of the profile dir, the user
197 cache dir is `Library/Caches` plus the relative path from `Application
198 Support` to the profile dir.
1992. Otherwise, the user cache dir is the same as the profile dir.
200
201Example (Mac OS X):
202
203* [user data dir] `~/Library/Application Support/Google/Chrome`
204* [profile dir] `~/Library/Application Support/Google/Chrome/Default`
205* [user cache dir] `~/Library/Caches/Google/Chrome/Default`
206
207On Linux, the user cache dir is derived from the profile dir as follows:
208
2091. Determine the system config dir. This is `~/.config`, unless overridden by
210 `$XDG_CONFIG_HOME`. (This step ignores `$CHROME_CONFIG_HOME`.)
2112. Determine the system cache dir. This is `~/.cache`, unless overridden by
212 `$XDG_CACHE_HOME`.
2133. If the system config dir is an ancestor of the profile dir, the user cache
214 dir is the system cache dir plus the relative path from the system config
215 dir to the profile dir.
2164. Otherwise, the user cache dir is the same as the profile dir.
217
218Example (Linux):
219
220* [user data dir] `~/.config/google-chrome`
221* [profile dir] `~/.config/google-chrome/Default`
222* [user cache dir] `~/.cache/google-chrome/Default`
223
224On Android, the user cache directory comes from
Steve Kobese26f53bd2017-07-06 00:15:02225[Context.getCacheDir](https://developer.android.com/reference/android/content/Context.html#getCacheDir%28%29).