I have a file URL for a PDF that I want to download using Chrome. wget is not an option, because Chrome is seemingly sending headers and cookies that I can't replicate. So what I need is to be able to run

/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --download-file http://url.etc/...

Assuming that it would send the cookies it already has for the URL domain. I have tried chrome-cli but there is no option to do something like this.

Functionally it is the same as opening a window in Chrome with the given URL, then right-clicking and hitting "Save as...". But I have a list of many PDFs that I need to download, so it has to be automated somehow.

EDIT: Meanwhile, found this.

EDIT #2: I'm not the only one! Link.

1 Answer 1


Instead wget you can use cURL in conjuction with chrome. Open chrome dev tools (F12), enter network tab and start your download. Now in network tab you will see new request. Click on it with mouse right button and select "Copy as cURL (cmd)". Open command line and paste clipboard. It should look something like this:

curl "someurl" -H "Pragma: no-cache" ..... -H "Cache-Control: no-cache" --compressed

This way you will copy all headers and cookies. Add to this command -o option which will allow you to actually download file.

curl "someurl" -H "Pragma: no-cache" ..... -H "Cache-Control: no-cache" --compressed -o myfile
  • This is a cool idea! I gave it a try, but even so, curl downloads a blank file. If it matters, the URL gets redirected to another, so I think this is where the issue lies...
    – Charles
    Jun 15, 2016 at 15:47
  • Heh. After reading the man page, adding the -L option to the command made it work (i.e. follow redirects with the same headers)! Thanks a lot for your tip!
    – Charles
    Jun 15, 2016 at 15:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .