Where are Chrome/Tampermonkey userscripts stored o

2020-02-07 18:59发布

问题:


Want to improve this question? Update the question so it's on-topic for Stack Overflow.

Closed 7 years ago.

Where are Chrome/Tampermonkey userscripts stored on the filesystem?

I want to edit user scripts directly instead of using the hokey in-browser editor.

回答1:

Tampermonkey scripts are super easy to update via the Tampermonkey tab. See the Tampermonkey FAQ, or just try it.

Tampermonkey scripts were stored in a special SQLite database and were/are not directly editable in file form.
Update: As of version 3.5.3630, Tampermonkey scripts are now stored using Chrome's extension storage. They are still not editable in file form, but the developer of Tampermonkey (derjanb) has helpfully made a Python script to extract them.


Chrome Userscripts (not the same as Tampermonkey scripts) are stored as follows, for the Chrome and Chromium browsers:

Windows XP:
  Chrome  : %AppData%\..\Local Settings\Application Data\Google\Chrome\User Data\Default\Extensions\
  Chromium: %AppData%\..\Local Settings\Application Data\Chromium\User Data\Default\Extensions\  

Windows Vista/7/8:
  Chrome  : %LocalAppData%\Google\Chrome\User Data\Default\Extensions\
  Chromium: %LocalAppData%\Chromium\User Data\Default\Extensions\

Linux:
  Chrome  : ~/.config/google-chrome/Default/Extensions/
  Chromium: ~/.config/chromium/Default/Extensions/

Mac OS X:
  Chrome  : ~/Library/Application Support/Google/Chrome/Default/Extensions/
  Chromium: ~/Library/Application Support/Chromium/Default/Extensions/

See this answer or this Google Groups thread.
Note that Chrome userscripts are automatically made into Chrome extensions with an auto-generated manifest.

However:

  1. Editing these files in place will not work. Chrome ignores and/or overwrites the changes.
  2. For Userscripts, set up your environment as in this answer, for easy editing and updating.
  3. Tampermonkey scripts are not stored the same way. They are stored, by Tampermonkey in a special SQLite database and are not directly editable that way. UPDATE: This was changed with version 3.5.3630, or so. See above.