Start Chrome with a temp profile & with preinstalled extension

Start Chrome with a temp profile

All Chrome Incognito windows share the same profiles, which make it harder when you need to debug a web application using  more then 2-3 accounts on the time. Using this script i create a temp profile folder and start chrome pointing to it. I also had to do a small change to the default Chrome installation to auto-install the AdBlock extension.


TEMP_DIR=$(mktemp -d $BASE_TEMP_DIR/google-chome.XXXXXXX)

echo "Running Chrome with temp folder in: $TEMP_DIR"
google-chrome --user-data-dir=$TEMP_DIR --no-first-run

rm -rf $TEMP_DIR

Preinstall extension

Edit the file – `/opt/google/chrome/default_apps/external_extensions.json`
I also removed all the default Google Apps, and replaced it content with

// Dictionary of default apps to install into new profiles.  Each entry maps
// the extension's id to its crx's path (relative to this file) and the version
// of the extension contained in the crx.
// When an extension is added or removed here, the two lists 'default_apps_list'
// and 'default_apps_list_linux_dest' in build/common.gypi must also be updated.
  "cfhdojbkjhnklbpkdaibdccddilifddb" : {
    // Load from a local file
    // "external_crx": "/path/to/file/adblock.crx",
    // "external_version": "1.0"
    // Install on launch
       "external_update_url": ""

Download Chrome CRX file

As for how to download the CRX file, a short Goggle search gave me this answer (which doesn’t work for me anymore — Updated 2014-12-17),


e.g - For AdBlock


Something else you can do is to install the extension from Goggle App Store, and then on the extension page > Enable “Developer mode” > And use “Pack Extension”, which will create the CRX file for you.

And here is a snippet of code I use

  "cjpalhdlnbpafiamejdnhcphjbkeiagm": { "external_update_url": "" },
  "ogfcmafjalglgifnmanfmnieipoejdcf": { "external_update_url": "" },
  "": {}



You may also like...

2 Responses

  1. Kamil says:

    You were the only person in whole internet to explain how to start Chrome with a preinstalled extension, thanks a lot!

    • Rabin says:

      glad I was able to help 🙂
      please not that you need a internet connection to download the extension you like to install, if you like it to work offline, you will need to install the extension and then copy the files (crx).

Leave a Reply

Your email address will not be published. Required fields are marked *