lha
35 years of .lzh archiver history,
now distributed as a single self-contained static binary.
Download for your platform Read the history
Static binaries · no libc install
required on any Linux, macOS, or Windows.
What is lha?
LHA (originally LHarc) is a file-compression and archival format created in 1988-1989 by Haruyasu Yoshizaki (a.k.a. Y.Tagawa). It uses the LZARI/LZHUF algorithms (arithmetic coding variants of LZ77 + Huffman) and the dominant archive format on MS-DOS and Japanese PCs through the 1990s, long before ZIP became universal.
lha (the binary) handles every common LZH variant
(-lh0-, -lh1-, -lh4-, -lh5-, -lh6-, -lh7-, -lhx-, -lzs-, and the
-lhd- directory header) plus the legacy LArc and PMarc formats.
The modern fork is mostly used for unpacking ancient
.lzh archives on systems where nothing else will
open them.
A brief history
1988–1989 — LHarc and LZARI
Haruyasu Yoshizaki (Y.Tagawa) released the original LHarc for MS-DOS in 1988-1989. It was the first widely used archive format in Japan to combine the LZARI arithmetic-coding variant of LZ77 with static Huffman. LZARI was originally published by Haruhiko Okumura; Tagawa's contribution was making it practical as an archive format.
1990–1991 — LZH enters
Yoshizaki refined the algorithm into LZHUF (LZ77 + dynamic
Huffman), released as the LHA format in 1990. The
archive header baked the compression method into the filename
suffix, which is why your old .lzh ends in
-lh5- or similar. Some modern compressors handle this
transparently; LHA-encoders choose the method explicitly.
1991–1993 — LHA for UNIX
Masaru Oki ported LHA to UNIX in 1991. Nobutaka Watazaki took over maintenance and rewrote most of the codebase in 1993, producing the canonical LHa for UNIX that ships to this day in long-tail distributions. The man page we still ship with this binary credits M. Oki and N. Watazaki — it's the same source.
LHA for UNIX used a custom freeware license that required
attribution, disallowed calling derived works "LHA", and
explicitly forbade binary-only redistribution without
contacting the maintainer. This is why, to this day, Debian
ships it under non-free/contrib.
1994–2010 — ZIP era, J2K file format
PKZIP 2.0 (1993) and Info-ZIP zip (1994 onward)
displaced LHA on Western PCs. In Japan, .lzh archives
remained in heavy use through the early 2000s — popular
websites served LZH for distribution, BBS attach them as a
matter of course, and Windows .exe self-extracting
archives used the LHA format extensively. J2K / 2ch-style
bulletin boards exchanged LZH files well into the 2000s.
2010–2020 — quiet maintenance
File sizes and bandwidth grew; LHA's small-adder CPU cost
stopped mattering. 7-Zip's LZMA + .7z delivered
much better ratios. Watazaki's LHA for UNIX tree got the
occasional patch but no new releases.
2022 — autoconf revival (jca02266)
In 2022, GitHub user jca02266 picked up the dormant tree and gave it a modern autoconf build. The result — LHa for UNIX 1.14i-ac20220213 — is what's vendored under upstream/lha/ in this repo. The original C source, the man pages, and the upstream test suite are all unchanged.
jca02266's autoconf work is the first time the format became
trivially buildable on any modern Linux distro without
hand-patching Makefiles. ljh-sh/lha takes that and produces
pre-built static binaries so end users don't even need to
apt install build-essential.
Compression methods supported
| Suffix | Algorithm | Notes |
|---|---|---|
-lh0- | stored (no compression) | Used for fast archiving. The meta header still records the method so older tools decode it correctly. |
-lh1- | LZARI (LZ77 + arithmetic) | Original LHarc method. Only the original MS-DOS
toolchain wrote this; most archives you'll encounter
are -lh5-. |
-lh4- | LZARI variant | Reserved for future use. Rare in the wild. |
-lh5- | LZHUF (LZ77 + dynamic Huffman) | The default. The standard LZH format since
1990. What you'll most often encounter as
.lzh today. |
-lh6- | LZARI+static Huffman variant | Experimental. Not widely seen. |
-lh7- | LZHUF+tree variant | Experimental. |
-lhx- | LZH-compatibility marker | Means the archive uses the updated LZH conventions
with a separate -lhd- directory header. |
-lzs- | LZARI variant | Reserved. |
Beyond the compression methods, lha also reads and writes
the legacy LArc and PMarc formats (configurable at
configure time). See lha --help for current defaults.
Download
Each archive contains:
bin/lha— the binaryman/man1/lha.1— the man pageREADME.md— install instructions
Latest releases at github.com/ljh-sh/lha/releases.
Fastest path on macOS / Linux (one shell line):
x i lha # x-cmd install database (resolves via x.eget → ljh-sh/lha)
x eget use lha # eget's bare-name resolver — equivalent, hits the same release
Both one-liners detect your OS + arch automatically, fetch the
matching static binary from
releases/latest,
extract it to ~/.local/bin/lha, and put it on
PATH. No compiler, no Homebrew tap, no apt-add-repo.
Or grab the per-platform tarball/zip directly:
| Platform | File | Notes |
|---|---|---|
| Linux x86_64 | lha-x86_64-linux-musl.tar.gz |
Fully static. Runs on every Linux distro (Alpine, Debian, RHEL, Arch…). |
| Linux ARM64 | lha-aarch64-linux-musl.tar.gz |
Fully static. Use on aarch64 Linux (e.g., Graviton, Ampere Altra, Pi 4/5 64-bit). |
| macOS Apple Silicon | lha-aarch64-macos.tar.gz |
Linker uses system libiconv (always present on macOS). |
| macOS Intel | lha-x86_64-macos.tar.gz |
Same link semantics. Cross-compiled from Apple Silicon; runs natively on Intel Macs and under Rosetta on Apple Silicon. |
| Windows x86_64 | lha-x86_64-windows.zip |
Built with MinGW; no VC redistributables needed. |
Install (optional, manual):
tar xzf lha-x86_64-linux-musl.tar.gz
sudo install -m 0755 lha-x86_64-linux-musl/bin/lha /usr/local/bin/lha
sudo install -m 0644 lha-x86_64-linux-musl/man/man1/lha.1 /usr/local/share/man/man1/
man lha
Build it yourself
The wrapper scripts are plain POSIX shell. From the repo root:
git clone https://github.com/ljh-sh/lha.git
cd lha
bash scripts/build.sh # host arch (autoreconf + configure + make)
cd upstream/lha && bash scripts/smoke.sh # upstream test suite, 20 cases
cd ../../ && bash scripts/build-alpine.sh # musl-static in alpine:3.20
bash scripts/build.sh && bash scripts/smoke.sh # host-side round-trip
See scripts/build.sh for the per-target flags (host vs musl vs MSYS2), and NOTICE.md for the upstream license terms that apply to the vendored binary.