webarchiver: Create safari webarchives from the command line.
November 29th, 2008 | Published in webarchiver | 7 Comments
Webarchiver allows you to create Safari .webarchive files from the command line. Webarchives are a convenient way to store a webpage and its associated files (images, css, javascript, etc) in a single file. It is very simple to use:
./webarchiver -url http://www.google.com -output google.webarchive
Usage $
./webarchiver
webarchiver 0.2
Usage: webarchiver -url URL -output FILE
Example: webarchiver -url http://www.google.com -output google.webarchive
-url http:// or path to local file
-output File to write webarchive to</code>
Do not forget the ‘http://’ if you want to archive a webpage. If no ‘http://’ is present then webarchiver attempts to archive a local file.
Download
The easiest way to install webarchiver is using MacPorts:
sudo port install webarchiver
webarchiver source code (latest release)
Release notes
Version 0.3 : Changed URL and sorted out source for git.
Version 0.2 : John Winter fixed page loading issue.
Version 0.1 : Initial release.
Credits
- Most of the credit for this goes to Keith Blount for his very useful KBWebArchiver class.
- John Winter for testing and bug fixing. Thanks John.
- Rob Griffiths for hosting a copy of the source when my blog was down.
- Boey Maun Suang for creating a MacPort

December 30th, 2008 at 8:56 pm (#)
Hi,
Thanks for making this! I used it (found on MacOSXHints) to assist with a custom signature creation application done using AppleScript and a shell script to create an HTML file that was then inserted into Mail.app after being turned into a webarchive. textutil would create webarchives that wouldn’t keep the image, but webarchiver would.
Source: http://github.com/Chealion/chealion/tree/master/Applescripts/Signatures
Don’t have a post explaining why it was done and everything quite yet.
December 30th, 2008 at 9:02 pm (#)
Micheal, Great to see you using it! And on github as well!
January 5th, 2009 at 4:25 pm (#)
Paul,
I’m curious if you may be able to help me understand something. I am developing some html pages which get pulled into an iPhone using OneDisk. These files must first be converted to the webarchive format to work withing the OneDisk browser. My problem is that I need the files to be download-able by anyone and they must be able to view them even when not connected to the web. The webarchive files all reach up to the server to get the other webarchive pages.
I may be stuck.
Thanks for any light you could throw on this.
January 5th, 2009 at 7:50 pm (#)
Phillip, I see your problem. I will look into it shortly and email you.
January 6th, 2009 at 2:51 am (#)
I do appreciate your time.
On Apple’s Dev site I see that a Manifest file does what I’m thinking of (it seems). I don’t know that the application I’m working with (OneDisk) can deal with this type of file yet.
June 5th, 2009 at 8:39 am (#)
Thanks so much for this! I incorporated it into a company-wide signature-updating tool, and I couldn’t have done it without this genius bit of code.
July 1st, 2009 at 12:06 am (#)
Nice work!
I’m compiling a list of applications, classes and commands that support WebArchive: http://www.diigo.com/list/grahamperrin/webarchive?v=p