Setting User-Agent for Mac Chrome

I was having problems watching instantly videos in my Netflix Queue since netflix doesn't yet recognize Chrome on the Mac (and possibly on the PC, haven't tested that.) Netflix knows which browser you're on by it's user-agent. That be changed when Chrome starts up. Here what I did on the Mac to change the user-agent to a version of Safari:

In Terminal enter:


Replace

/Applications/Google\ Chrome.app

with the location of "Google Chrome.app" if it's not in the /Applications folder or under a different name.
To automate, put in a shell file that you can manually run or set to automatically load at startup.
Note: This works on the terminal "open" in Snow Leopard. But in the Leopard version of "open", the "--args" parameter does not look to be supported.
Update: Angelo, in message below says

For Leopard (10.5.X) (not Snow Leopard) use this:
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome –args -user-agent="Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_8; en-us) AppleWebKit/525.19 (KHTML, like Gecko) Version/3.2.1 Safari/525/19"

64,555 views

12 Responses to “Setting User-Agent for Mac Chrome”


  1. 1 Mitch

    I tried this and got an error:

    -bash: syntax error near unexpected token `(‘

  2. 2 enric

    Mitch,

    Sorry, WordPress defaults to fancy (smart) quotes. They’ve been turned off so copying the code should work. Also the “open” command on Snow Leopard supports “–args” parameter, but not the one on Leopard. I’ve updated the post to reflect that.

  3. 3 Mitch

    I actually needed Firefox and Chromium so I did the following:

    open /Applications/Chromium.app –args -user-agent=”Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.9.1) Gecko/20090703 Firefox/3.5″

    Used the user agent list at http://www.useragentstring.com/pages/useragentstring.php

    Worked like a charm. THANKS!!!!

  4. 4 Mitch

    Hmmm… using this now:

    open /Applications/Chromium.app –args -user-agent=”Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.1.6) Gecko/20091201 Firefox/3.5.6 (.NET CLR 3.5.30729)”

    I know how to take a script and make it an app in AppleScript Editor but what is the syntax to make this work as a script?

  5. 5 enric

    Mitch,

    A script is a file with commands in it like the one using “open”. In Unix — which is the basis for Mac OS — it’s a shell script. Here are a couple of pages I found quickly doing a search:

    http://www.askdavetaylor.com/how_do_i_create_a_shell_script_on_a_macintosh.html
    http://macdevcenter.com/pub/a/mac/2003/11/07/scripting_osx.html

    — Enric

  6. 6 Angelo

    For Leopard (10.5.X) (not Snow Leopard) use this:
    /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome –args -user-agent=”Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_8; en-us) AppleWebKit/525.19 (KHTML, like Gecko) Version/3.2.1 Safari/525/19″

  7. 7 Oscar

    I have a quick question, I typed the code in terminal with chrome off, it opens up and can play netflix video, but once I close the browser it won’t play netflix videos again unless I type in the code again is there anyway to make chrome open automatically with netflix capabilities even when I restart the browser?

  8. 8 Michael

    I am in the same boat as Oscar. I would like to be able to change this setting in Google Chrome permanently. I understand that a Shell script would be an alternative way of running Google Chrome to achieve this effect, but I was hoping there might be a way using Terminal to permanently apply this effect to the Google Chrome app ??

  9. 9 enric

    Hi Michael,

    There may be a method to set the Google Chrome app to default to a user-agent. Maybe someone will reply with that. I haven’t looked deeper than what I’ve already written.

    Good luck.

  10. 10 Andrew

    I am running leopard and this is what I enter into the terminal…

    /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome –args -user-agent=”Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_3; en-us) AppleWebKit/525.19 (KHTML, like Gecko) Version/3.2.1 Safari/525.19″

    And this is the error I get
    Google Chrome Helper[4289] : The function `CGAccessSessionSkipBytes’ is obsolete and will be removed in an upcoming update. Unfortunately, this application, or a library it uses, is using this obsolete function, and is thereby contributing to an overall degradation of system performance. Please use `CGAccessSessionSkipForward’ instead.

    Google chrome does load but it says that my profile wasn’t open and some features of google chrome may not work properly.

    Any help would be great, thanks!

  11. 11 Michelle

    Andrew,
    enter what you just typed above into the terminal, but go back and manually change the two quotations. When you copy and paste into the terminal from this site, it uses what are called smart quotes (the ones that curve), and Terminal won’t recognize this. If you delete the existing quotes and re-type them, it should work just fine!

  12. 12 eSko

    Thank you very much, you saved my day :)

Comments are currently closed.