Chromium --temp-profile option

Hi everyone.

In Ubuntu version of chromium-browser, there’s a nice command-line option “–temp-profile”, it starts Chromium with a disposable profile. It’s very useful for developing purposes. Does anyone knows if there’s a similar option on Fedora’s chromium or chromium-freeworld? I’ve tried with the same command line option, but it simply doesn’t works.

1 Like

Hello @eduararley

In the chromium browser shipped with Fedora, there is not such option.
In the package shipped with Ubuntu, there is such option.
However, as far as I can see, this option is not a Chromium option, but on Ubuntu it is provided by the bash script that actually launches Chromium. It is a wrapper around another option.

If you look at the Ubuntu’s (and Debian) package, for instance the source package, there is a script called chromium-browser.sh
The --temp-profile option is provided here.

...
want_temp_profile=0
...
while [ $# -gt 0 ]; do
  case "$1" in
...
    --temp-profile )
      want_temp_profile=1
      shift ;;
...

if [ $want_temp_profile -eq 1 ] ; then
  TEMP_PROFILE=`mktemp -d`
  CHROMIUM_FLAGS="$CHROMIUM_FLAGS --user-data-dir=$TEMP_PROFILE"
fi
...

  $LIBDIR/$APPNAME $CHROMIUM_FLAGS "$@"
  rm -rf $TEMP_PROFILE
...

So, the --temp-profile option is a wrapper for the Chromium’s --user-data-dir= actual option, that is documented in the man page, plus an mktemp command.

4 Likes

Hi @alciregi, thanks for your help.

You’re right, they do it through a custom bash script. However, I don’t like to have some bash script somewhere just for that function. So, I’ve replicated this using a simple desktop file on my local home folder. This is a quick script, if anyone needs the same; just copy and paste it on a terminal. It will copy system’s chromium-freeworld desktop file on your local applications folder, and add the command for Temp Profile. After that, reloads gnome-shell to reflect the change:

rm -f ~/.local/share/applications/chromium-freeworld.desktop
cp /usr/share/applications/chromium-freeworld.desktop ~/.local/share/applications/
sed -i '/Actions=/ s/$/new-temp-profile;/' ~/.local/share/applications/chromium-freeworld.desktop
cat >> ~/.local/share/applications/chromium-freeworld.desktop << EOF

[Desktop Action new-temp-profile]
Name=New Temp Profile Window
Name[en_GB]=New Temp Profile Window
Name[es]=Nuevo perfil temporal
Exec=/usr/bin/env bash -c "TEMP_PROFILE=`mktemp -d /tmp/chromium-XXX` && chromium-freeworld --user-data-dir=\$TEMP_PROFILE; rm -rf \$TEMP_PROFILE"

EOF

gdbus call --session --dest org.gnome.Shell --object-path /org/gnome/Shell --method org.gnome.Shell.Eval 'Meta.restart("Restarting...")'
1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.