12

To run chrome in headless mode, I did

alias chrome="/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome"

chrome --remote-debugging-port=9222 --disable-gpu --headless

in console, But, I got this error,

[0305/140111.481537:ERROR:xattr.cc(64)] setxattr org.chromium.crashpad.database.initialized on file /var/folders/m3/92mmh21n0cx4ppf8c3bcns38hd4_kk/T/: Operation not permitted (1) [0305/140111.484254:ERROR:xattr.cc(64)] setxattr org.chromium.crashpad.database.initialized on file /var/folders/m3/92mmh21n0cx4ppf8c3bcns38hd4_kk/T/: Operation not permitted (1) [0305/140111.484254:INFO:crashpad_client_mac.cc(292)] restarting handler in 0.983s [0305/140111.513641:ERROR:gpu_process_transport_factory.cc(1009)] Lost UI shared context. [0305/140111.513709:ERROR:instance.cc(49)] Unable to locate service manifest for metrics [0305/140111.513733:ERROR:service_manager.cc(890)] Failed to resolve service name: metrics [0305/140111.514229:ERROR:socket_posix.cc(142)] bind() returned an error, errno=48: Address already in use (48)

DevTools listening on ws://[::1]:9222/devtools/browser/c46563ca-1891-48bd-bdd6-e6122f3f3b5d [0305/140112.484141:ERROR:xattr.cc(64)] setxattr org.chromium.crashpad.database.initialized on file /var/folders/m3/92mmh21n0cx4ppf8c3bcns38hd4_kk/T/: Operation not permitted (1) [0305/140112.484641:INFO:crashpad_client_mac.cc(292)] restarting handler in 0.985s [0305/140113.489618:ERROR:xattr.cc(64)] setxattr org.chromium.crashpad.database.initialized on file /var/folders/m3/92mmh21n0cx4ppf8c3bcns38hd4_kk/T/: Operation not permitted (1) [0305/140113.490274:INFO:crashpad_client_mac.cc(292)] restarting handler in 0.979s [0305/140114.484881:ERROR:xattr.cc(64)] setxattr org.chromium.crashpad.database.initialized on file /var/folders/m3/92mmh21n0cx4ppf8c3bcns38hd4_kk/T/: Operation not permitted (1) [0305/140114.485349:INFO:crashpad_client_mac.cc(292)] restarting handler in 0.985s [0305/140115.489188:ERROR:xattr.cc(64)] setxattr org.chromium.crashpad.database.initialized on file /var/folders/m3/92mmh21n0cx4ppf8c3bcns38hd4_kk/T/: Operation not permitted (1) [0305/140115.489638:INFO:crashpad_client_mac.cc(292)] restarting handler in 0.985s

I also tried,

/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --remote-debugging-port=9222 --disable-gpu --headless

but I got same error.

Is there any solution for this?

Expert wanna be
  • 10,218
  • 26
  • 105
  • 158

3 Answers3

34

I got the answer from Chrome crashpad crashes on xattr

Just provide a different directory for "crash dumps" when starting Chrome, like this:

/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --remote-debugging-port=9222 --disable-gpu --headless --crash-dumps-dir=/tmp
IKavanagh
  • 6,089
  • 11
  • 42
  • 47
吴张明
  • 379
  • 3
  • 6
4

add the following command flags

--disk-cache-dir=/tmp --user-data-dir=/tmp --crash-dumps-dir=/tmp

eg.

chrome --headless --disable-gpu --screenshot --disk-cache-dir=/tmp --user-data-dir=/tmp --crash-dumps-dir=/tmp http://m.baidu.com

For more command-line flags, see here

Taylor D. Edmiston
  • 12,088
  • 6
  • 56
  • 76
爱国者
  • 4,298
  • 9
  • 47
  • 66
-6

UPDATE 3/6
I checked the solution on my own MacBook and it worked.


I encounter the same issue today, and after searching some document, I suspect it's due to the SIP(System Integrity Protection) feature in MacOS, with that restrict, you can't modify the files under /var folder even you have the root privilege.

So here is the way to disable that feature:

  1. Turn off your Mac (Apple > Shut Down).
  2. Hold down Command-R and press the Power button. Keep holding Command-R until the Apple logo appears.
  3. Wait for OS X to boot into the OS X Utilities window.
  4. Choose Utilities > Terminal.
  5. Enter csrutil disable.
  6. Enter reboot.
tntC4stl3
  • 22
  • 2