I'm currently running on OS X El Capitan, and I'd like to make run Google Chrome in headless mode on startup. So far I've tried to do this via Terminal but I have been unable to find a proper way to even launch Headless Mode. What am I doing wrong?

I've tried all combinations, the only one that currently works for me is:

open -a ''Google Chrome'' http://www.google.com

But no headless mode yet.

And based on my limited knowledge, the proper way to make this launch on startup is by using a bash file. Correct me if I'm wrong.

Any suggestions will be greatly appreciated.


First, be sure you are using at least v59 of Google Chrome, which introduced the headless feature.

If so, the below may work for you:

chrome --headless --remote-debugging-port=9222 http://www.google.com

You'll need to set an alias for the command-line executable for Chrome with the following (assuming Chrome is installed in the standard location):

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

To test the above, you can try going to this address (in a different browser):


Check this page out at Google for reference.

Here is a short script that you may find useful:


chrome="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
"$chrome" --headless --remote-debugging-port="$port" "$url" &
  • Works like a charm! but issues appear whenever I try to make this a .sh file. Here's the thing, I'm trying to make a file (.sh is what so far I've considered as an option) to launch headless Google Chrome on startup and... if it is possible, to prevent it from closing even from the Activity Monitor (or relaunch it when closed). I've done it on Windows by using .bat and .vbs files and the transition seemed pretty straight forward but boy I was so wrong. Can you give me a clue to do such thing? I've tried to start Chrome with $, "...", even with the full path. Nothing seems to work. – Eat-man Jan 25 '18 at 16:57
  • @Eat-man What does your script look like? Is Chrome starting up and stopping - or is it not executed at all? – Scot Jan 26 '18 at 0:27
  • The only way it works is via Terminal by typing in the commands from your last post. Seems to be working as far as I can see from the Activity Monitor because the process appears. If I close the terminal window, it shuts the process too, and I haven't been able to figure out what to do to hide the terminal window. Here's what I've done so far. But it keeps showing me: "chrome: command not found" #!/bin/bash echo off alias chrome="/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome" | chrome --headless --remote-debugging-port=9222 http://www.google.com – Eat-man Jan 26 '18 at 4:37
  • Sorry for the 6 edits, I'm a newbie and I'm having issues with the format. – Eat-man Jan 26 '18 at 4:45
  • @Eat-man No problem about the edits - I do the same as I iterate. I added a script that should work into the answer above - it renders a little better there than in a comment. Let me know if it works, or doesn't, & I'll edit if needed. – Scot Jan 26 '18 at 5:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.