webarchive
Extract .webarchive files (saved from Safari) into plain HTML/assets using the WebArchiveExtractor CLI. Use when the user wants to unarchive, extract, or convert a .webarchive file.
install
source · Clone the upstream repo
git clone https://github.com/robrohan/WebArchiveExtractor
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/robrohan/WebArchiveExtractor "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/webarchive" ~/.claude/skills/robrohan-webarchiveextractor-webarchive && rm -rf "$T"
manifest:
skills/webarchive/SKILL.mdsource content
The user wants to extract a
.webarchive file using WebArchiveExtractor.
If arguments were provided (
$ARGUMENTS), use them to infer the input file and optionally the output directory or URL prepend. Otherwise, ask the user for the path to the .webarchive file.
How to run WebArchiveExtractor
/Applications/WebArchiveExtractor.app/Contents/MacOS/WebArchiveExtractor [-h] [-o <OutputDirectory>] [-p <URLPrepend>] -i <WebArchiveFile>
Options:
— required — path to the-i <WebArchiveFile>
file.webarchive
— directory to write extracted files into (optional; defaults to a directory named after the archive next to it)-o <OutputDirectory>
— URI prefix to prepend to all asset URLs in the extracted HTML (optional; useful when serving the result from a subdirectory)-p <URLPrepend>
Shorthand (no flag):
WebArchiveExtractor website.webarchive
A positional argument is treated as the
-i value.
Prerequisites
The app must be installed at
/Applications/WebArchiveExtractor.app. Check with:
test -x /Applications/WebArchiveExtractor.app/Contents/MacOS/WebArchiveExtractor && echo "found" || echo "not installed"
If not found, tell the user to build and install from source (
xcodebuild -project WebArchiveExtractor.xcodeproj) or drag a release build to /Applications.
To use
WebArchiveExtractor without the full path, the user can add it to PATH:
export PATH="$PATH:/Applications/WebArchiveExtractor.app/Contents/MacOS/"
Or create a symlink:
ln -s /Applications/WebArchiveExtractor.app/Contents/MacOS/WebArchiveExtractor ~/.local/bin/WebArchiveExtractor
Steps
- Check the binary exists using the test command above. If not found, stop and direct the user to install the app.
- Determine the input
file from.webarchive
or ask the user.$ARGUMENTS - Determine the output directory:
- If the user explicitly provided one in
, use that.$ARGUMENTS - Otherwise, default to
(where~/Downloads/<archive-name>
is the input filename without the<archive-name>
extension)..webarchive - If the user asks why
is the default, explain: macOS sandboxes the WebArchiveExtractor app, which restricts which directories the CLI can write to. The~/Downloads
folder is one of the few locations reliably accessible, so it's used as the default to avoid silent failures.~/Downloads
- If the user explicitly provided one in
- Determine (optional) URL prepend from
or ask if needed.$ARGUMENTS - Run the extractor using the Bash tool:
/Applications/WebArchiveExtractor.app/Contents/MacOS/WebArchiveExtractor -i "<input>" -o "<output>" [-p "<prepend>"] - If successful, list the output directory contents with
and summarise:ls- The output directory path
- How many files were extracted
- The main HTML file name (if identifiable)
- Offer to open the extracted HTML in the browser with
.open <file>
Notes
is a macOS-specific binary plist format used by Safari's "Save As Web Archive" feature..webarchive- The CLI and the GUI app are the same binary — running with
suppresses the GUI.-i - Running with no arguments launches the GUI instead of extracting anything.