Contents
When you open Chrome from the command-line, it opens the default or last opened Chrome profile. As of now, there is no way to open a specific Chrome profile. If you want to open a specific Chrome profile, I recommend you make that profile the default one in Windows. Also, as of now, there is no way to open multiple URLs from the command line. For production build on a non-rooted device, you need to enable 'Enable command line on non-rooted devices' in chrome://flags, then set command line in /data/local/tmp/chrome-command-line. When doing that, mind that the first command line item should be a '.
- 5 Android
There are command line flags (or 'switches') that Chromium (and Chrome) accept in order to enable particular features or modify otherwise default functionality.
Current switches may be found at http://peter.sh/examples/?/chromium-switches.html
It is important to note that some switches are intended for temporary cases and may break in the future.
Note that if you look at chrome://flags
to see if the command line option is active, the state might not be accurately reflected. Check chrome://version
for the complete command line used in the current instance.
Windows
- Exit any running-instance of Chrome.
- Right click on your 'Chrome' shortcut.
- Choose properties.
- At the end of your 'Target:' line add the command line flags. For example:
--disable-gpu-vsync
- With that example flag, it should look like below (replacing '--disable-gpu-vsync' with any other command line flags you want to use):
chrome.exe --disable-gpu-vsync
- Launch Chrome like normal with the shortcut.
macOS
- Quit any running instance of Chrome.
- Run your favorite Terminal application.
- In the terminal, run commands like below (replacing '--remote-debugging-port=9222' with any other command line flags you want to use):
/Applications/Chromium.app/Contents/MacOS/Chromium --remote-debugging-port=9222
# For Google Chrome you'll need to escape spaces like so:
/Applications/Google Chrome.app/Contents/MacOS/Google Chrome --remote-debugging-port=9222
Chrome Command Line Editor
Linux
- Quit any running instance of Chrome.
- Run your favorite terminal emulator.
- In the terminal, run commands like below (replacing '--remote-debugging-port=9222' with any other command line flags you want to use):
chromium-browser --remote-debugging-port=9222
google-chrome --foo --bar=2
V8 Flags
V8 can take a number of flags as well, via Chrome's js-flags
flag. For example, this traces V8 optimizations:
chrome.exe --js-flags='--trace-opt --trace-deopt --trace-bailout'
To get a listing of all possible V8 flags:
Browse the V8 wiki for more flags for V8.
Android
Visit 'about:version
' to review the flags that are effective in the app.
If you are running on a rooted device or using a debug build of Chromium, then you can set flags like so:
out/Default/bin/chrome_public_apk argv # Show existing flags.
out/Default/bin/content_shell_apk argv --args='--foo --bar' # Set new flags
You can also install, set flags, and launch with a single command:
out/Default/bin/chrome_public_apk run --args='--foo --bar'
out/Default/bin/content_shell_apk run # Clears any existing flags
For production build on a non-rooted device, you need to enable 'Enable command line on non-rooted devices' in chrome://flags, then set command line in /data/local/tmp/chrome-command-line. When doing that, mind that the first command line item should be a '_' (underscore) followed by the ones you actually need. Finally, manually restart Chrome ('Relaunch' from chrome://flags page might no be enough to trigger reading this file). See https://crbug.com/784947.
ContentShell on Android
There's an alternative method for setting flags with ContentShell that doesn't require building yourself:
- Download a LKGR build of Android.
- This will include both ChromePublic.apk and ContentShell.apk
- Install ContentShell APK to your device.
- Run this magic incantation
-a android.intent.action.VIEW
-n org.chromium.content_shell_apk/.ContentShellActivity
--esa commandLineArgs --show-paint-rects,--show-property-changed-rects
This will launch contentshell with the supplied flags. You can apply whatever commandLineArgs you want in that syntax.
Android WebView
This is documented in the chromium tree.
Chrome OS
Chrome Command Line Arguments
- Put the device into dev mode, disable rootfs verification, and bring up a command prompt.
- Modify /etc/chrome_dev.conf (read the comments in the file for more details).
- Restart the UI via:
sudo restart ui