Run Chrome From Terminal Mac



Contents

  1. 5 Android

The Chrome Remote Desktop tool is almost a decade old but because it is a browser-based tool, it can run into all sorts of problems that prevent a connection from being established. Uninstalling and reinstalling the app will fix the problem in many cases. If you get the path where the application is installed then you can run the application from there. For example to know the path where google-chrome is located run this command: whereis google-chrome You will get the path like: google-chrome: /usr/bin/google-chrome /usr/bin/X11/google-chrome /usr/share/man/man1/google-chrome.1. Start chrome /incognito. To do this from the Run program, enter this command instead: chrome /incognito. Chrome will now open in incognito mode. Jump Straight to a Specific Website. If you want to save yourself a step and open a specific website in Chrome from the Command Prompt, you can do so by running this command: start chrome www. How to Run Google Chrome in a Terminal. Running applications from a terminal can have a few benefits, particularly if you program for a particular environment and want your application to run. You can open Google Chrome from terminal very surprisingly by running. Google-chrome You can also start Firefox by running. Firefox And you can add an URL as a parameter to open it too. Firefox www.askubuntu.com.

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

  1. Exit any running-instance of Chrome.
  2. Right click on your 'Chrome' shortcut.
  3. Choose properties.
  4. At the end of your 'Target:' line add the command line flags. For example:
    • --disable-gpu-vsync
  5. 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
  6. Launch Chrome like normal with the shortcut.

macOS

  1. Quit any running instance of Chrome.
  2. Run your favorite Terminal application.
  3. 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

Linux

  1. Quit any running instance of Chrome.
  2. Run your favorite terminal emulator.
  3. 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

Run Chrome From Terminal Mac Shortcut

V8 Flags

V8 can take a number of flags as well, via Chrome's js-flags flag. For example, this traces V8 optimizations:

Terminal
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:

  1. Download a LKGR build of Android.
  2. This will include both ChromePublic.apk and ContentShell.apk
  3. Install ContentShell APK to your device.
  4. Run this magic incantation
-a android.intent.action.VIEW
Run Chrome From Terminal Mac
-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

Run Chrome From Terminal Mac

This is documented in the chromium tree.

Chrome OS

  1. Put the device into dev mode, disable rootfs verification, and bring up a command prompt.
  2. Modify /etc/chrome_dev.conf (read the comments in the file for more details).
  3. Restart the UI via:
    sudo restart ui

Apple is planning on selling Macs with arm chips by the end of 2020. This document describes the state of native binaries for these Macs.

There's a bot that builds for arm. It cross-builds on an Intel machine.

There's also a tester bot that continuously runs tests. Most tests pass.

Building for arm Macs

You can build Chrome for arm macs on an Intel Mac. To build for arm64, you have to do 2 things:

  1. use the MacOSX11.0.sdk that comes with Xcode 12.2. If you‘re on Google’s corporate network, this SDK is part of the hermetic toolchain and will be used automatically. Otherwise, manually download and install this version of Xcode and, if necessary, make it the active Xcode with xcode-select.

  2. Add target_cpu = 'arm64' to your args.gn.

Then build normally.

To run a built Chromium, you need to copy it to your arm mac. If you don‘t do a component build (e.g. a regular is_debug=false build), you can just copy over Chromium.app from your build directory. If you copy it using macOS’s “Shared Folder” feature and Finder, Chromium.app should be directly runnable. If you zip, upload Chromium.app to some web service and download it on the DTK, browsers will set the com.apple.quarantine bit, which will cause Finder to say 'Chromium' is damanged and can't be opened. You should move it to the Trash.'. In Console.app, the kernel will log kernel: Security policy would not allow process: 2204, /Users/you/Downloads/Chromium.app/Contents/MacOS/Chromium and amfid will log amfid: /Users/you/Downloads/Chromium.app/Contents/MacOS/Chromium signature not valid: -67050. To fix this, open a terminal and run

After that, it should start fine.

As an alternative to building locally, changes can be submitted to the opt-in mac-arm64-rel trybot. A small number of swarming bots are also available for Googlers to run tests on.

You can follow the Mac-ARM64 label to get updates on progress.

Universal Builds

A “universal” (or “fat”) .app can be created from distinct x86_64 and arm64 builds produced from the same source version. Chromium has a universalizer.py tool that can then be used to merge the two builds into a single universal .app.

The universal build is produced in this way rather than having a single all-encompassing gn configuration because:

  • Chromium builds tend to take a long time, even maximizing the parallelism capabilities of a single machine. This split allows an additional dimension of parallelism by delegating the x86_64 and arm64 build tasks to different machines.
  • During the mac-arm64 bring-up, the x86_64 and arm64 versions were built using different SDK and toolchain versions. When using the hermetic SDK and toolchain, a single version of this package must be shared by an entire source tree, because it’s managed by gclient, not gn. However, as of November 2020, Chromium builds for the two architectures converged and are expected to remain on the same version indefinitely, so this is now more of a historical artifact.

Building on arm Macs

It's possible to build on an arm Mac, without Rosetta. However, this configuration is not yet covered by bots, so it might be broken from time to time. If you run into issues, complain on https://crbug.com/1103236

Open Chrome From Terminal Mac New Window

Also, several of the hermetic binaries in depot_tools aren‘t available for arm yet. Most notably, vpython is not yet working (tracking bug). vpython is needed by git cl, so things like git cl upload don’t yet work on an arm Mac. The build will also use system python, python3, and git, instead of depot_tools's hermetic versions for now.

However, enough works to be able to check out and build (with goma too), with some setup.

  1. opt in to arm64 binaries from cipd by running

    (If you want to build tools/metrics:histograms_xml, you also need to echo arm64 > third_party/depot_tools/.cipd_client_platform in your chromium checkout. This isn't needed for building chromium or any test targets.)

  2. opt out of vpython by running

Run Chrome From Terminal Macbook

With this, you should be able to run fetch chromium normally, and then build, using gn, ninja etc like normal.

Open Chrome Incognito From Command Line Mac

gtest-based binaries should build, run, and mostly pass. Web tests probably don't work yet due to lack of an arm apache binary (tracking bug).