Safari offers the .webarchive format to download a webpage, together with embedded resources (images, etc). As described/linked in answers to How do I turn a Safari Webarchive file into a folder?, there are several apps available to extract the contents of a .webarchive into a folder containing the individual files. However, all the answers given are GUI apps (except for the textutil answer, which unfortunately doesn’t do what’s requested, as explained in its comments). However, I would prefer a command-line solution, for easier scriptability etc.

Is there a way to extract the contents of a .webarchive file from the command line?

  • 1
    You might want to consider using something like SiteSucker, which will download all the linked resources for a site, thus cutting out the webarchive process.
    – benwiggy
    Jan 25 at 13:56
  • @benwiggy a webarchive captures what is loaded in the browser window. SiteSucker simulates an extended browsing session through the whole site. Without setting a lot of restrictions (& knowing how to do so correctly), you always get a lot more than you want.
    – Pedro
    Nov 25 at 9:56

1 Answer 1


Web Archive Extractor

It's not a command line application but it does include an Automator workflow, and those can be run from the command line by running /usr/bin/automator <path to workflow>.

  • 1
    This doesn't work on my MBP M2 running Sonoma. I downloaded the project. It's quite outdated Obj-C code that will take some work to update.
    – Pedro
    Nov 25 at 9:53
  • That's a shame. Nov 26 at 14:37
  • Yeah they all look broken. But it seems pretty easy to parse out the data from the bplist. I might do that as a side project. Nov 27 at 8:30

You must log in to answer this question.

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