Mastering Chromium: How to Launch with Command-Line Switches for Enhanced Control
Chromium, the open-source project behind Google Chrome, offers a plethora of command-line switches that allow you to fine-tune its behavior. These switches can enable experimental features, modify default functionalities, and aid in debugging. This guide provides a comprehensive overview of how to use these switches across various operating systems.
While a complete list doesn't exist, a substantial collection can be found at Peter Beverloo's Chromium Command Line Switches.
Important Considerations:
- Switches vs. Flags: Be aware that Chrome switches (e.g.,
--incognito
) are distinct from Chrome flags (e.g.,chrome://flags/#ignore-gpu-blocklist
). A feature might be enabled through either a switch, a flag, or both. - Purpose: Some switches are for development and may be unstable or removed without notice. For managing Chrome in enterprise environments, use Chrome Enterprise Policies instead.
- Verification: Don't solely rely on
chrome://flags
to confirm if a switch is active. The most reliable method is to checkchrome://version
for the complete command line used by the current instance.
How to Implement Command-Line Switches on Different Platforms
Windows
- Close Chromium: Ensure all Chrome instances are closed by navigating to
chrome://quit
. - Shortcut Properties: Right-click your Chrome shortcut and select "Properties."
- Modify Target: In the "Target:" field, add the desired switch at the end of the existing path. For instance:
"C:\Program Files\Google\Chrome\Application\chrome.exe" --disable-gpu-vsync
- Launch: Start Chrome using the modified shortcut.
macOS
-
Quit Chromium: Fully quit Chromium using
chrome://quit
. -
Open Terminal: Launch your preferred terminal application.
-
Execute Command: Run Chromium with the desired switch. Remember to escape spaces in the path for Google Chrome:
Linux
-
Close Chromium: Exit all running instances of Chromium.
-
Open Terminal: Open your terminal emulator.
-
Run Command: Start Chromium with the switch. Use
chromium-browser
orgoogle-chrome
depending on which browser you're using:
iOS
- Custom Builds: Only Chromium builds compiled from source code support command-line switches on iOS.
- Open the Settings app
- Go to Chromium/Experimental Settings
- Add your switches in the "Extra flags (one per line)". Switch on the "Append Extra Flags" setting.
- Official Releases: Google Chrome from the App Store or TestFlight does not support command-line switches.
Harnessing V8 Flags
The V8 JavaScript engine (powering Chromium and Chrome) can be configured via Chrome's js-flags
switch.
-
Example: To trace V8 optimizations:
chrome.exe --js-flags="--trace-opt --trace-deopt --trace-bailout"
-
Listing Flags: Obtain a complete list of V8 flags using:
chrome.exe --js-flags="--help"
-
V8 Documentation: Explore additional flags in the V8 documentation.
Android
Access about:version
within the app to see the active command-line switches.
Rooted Devices/Debug Builds:
Install and Run with Switches:
Production Builds (Non-Rooted):
- Enable "Enable command line on non-rooted devices" in
chrome://flags
. - Set command-line arguments in
/data/local/tmp/chrome-command-line
. The first argument must be an underscore ("_"). - Manually restart Chrome (the "Relaunch" button in
chrome://flags
may not be sufficient). See crbug.com/784947 for further information.
ContentShell on Android
ContentShell provides an alternative way to set switches:
-
Download an LKGR (Last Known Good Revision) build.
-
Install
ContentShell.apk
from the downloaded archive. -
Use the following command:
Android WebView
Refer to the Chromium tree documentation for WebView-specific command-line flags.
Chrome OS
- Enter dev mode, disable rootfs verification, and access a command prompt (see Chromium OS Developer Mode documentation).
- Modify
/etc/chrome_dev.conf
. Consult the file's comments for instructions. - Restart the UI:
sudo restart ui
By following these steps, you can leverage Chromium's command-line switches to customize your browsing experience, test new features, and troubleshoot issues. Remember to use these powerful tools responsibly and be aware of their potential impact on stability.