Repository navigation
Support zstd-compressed package archives: CRAN's current macOS binaries fail with "unknown archive type" #485
Description
Request
Please recognize zstd-compressed tarballs in detect_package_archive_type().
CRAN's macOS builder has started compressing .tgz binaries with zstd, and pkgdepends rejects those archives before extraction, so pak cannot install affected packages on macOS at all.
I searched the pkgdepends and pak issues, pull requests and commit history for zstd, unknown archive type, and macOS binary compression, and found no existing report or pending fix.
Discovery context
A package's GitHub Actions matrix started failing on 2026-09-20 in the macOS job, during dependency installation, while the commit under test changed only documentation. Linux and Windows passed on the same commit, and the same macOS job had passed on the previous commit the day before:
✔ Got knitr 1.52 (aarch64-apple-darwin23) (992.43 kB)
Error:
! error in pak subprocess
Caused by error in `make_install_process(filename, lib = lib, metadata = metadata)`:
! Cannot extract
'/var/folders/.../bin/macosx/sonoma-arm64/contrib/4.6/knitr_1.52.tgz',
unknown archive type.
Full log: https://github.com/RGenomicsETL/CanardAbsurd/actions/runs/35490731798/job/106025966856
The reported 992.43 kB did not match the 1,077,421 bytes the same file has on Posit Package Manager, which first looked like a truncated download.
Clearing the runner caches and re-running three times reproduced it exactly, and fetching CRAN's copy directly showed the difference is the compression format, not a corrupt transfer.
Reproduction
This needs no macOS runner; the detection is pure R. On Linux, R 4.6.0,
pkgdepends 0.9.1:
url <- "https://cloud.r-project.org/bin/macosx/sonoma-arm64/contrib/4.6/knitr_1.52.tgz"
download.file(url, f <- tempfile(fileext = ".tgz"), mode = "wb")
readBin(f, "raw", 4)
#> [1] 28 b5 2f fd # zstd magic
untar(f, list = TRUE)[1:3]
#> [1] "knitr/" "knitr/CITATION" "knitr/misc/" # base R reads it
pkgdepends:::detect_package_archive_type(f)
#> [1] "unknown"untar() lists the archive with both tar = "internal" and the external tar,
so R itself handles these files.
What CRAN now serves
Sampled from bin/macosx/sonoma-arm64/contrib/4.6/ on cloud.r-project.org:
| Package | First bytes | Compression | Size |
|---|---|---|---|
| knitr 1.52 | 28 b5 2f fd |
zstd | 992,429 |
| xfun 0.61 | 28 b5 2f fd |
zstd | 656,512 |
| cli 3.6.6 | 1f 8b 08 00 |
gzip | 1,487,045 |
| jsonlite 2.0.0 | 1f 8b 08 00 |
gzip | 1,112,267 |
| evaluate 1.0.5 | 1f 8b 08 00 |
gzip | 103,958 |
Recently built packages are zstd and older ones are still gzip, so this should
spread as CRAN rebuilds. Posit Package Manager still publishes gzip builds of
the same versions (knitr_1.52.tgz is 1,077,421 bytes there), which is why the
failure depends on which repository a runner resolves.
Where it fails
detect_package_archive_type() in R/install-tar.R tests only gzip, zip,
bzip2 and xz magic bytes and returns "unknown" otherwise. R/install-binary.R
then throws install_input_error rather than extracting.
Suggested direction
Detecting the zstd magic 28 b5 2f fd looks sufficient for the tar path: the
compression-flag helper already returns no flag for types it does not name, and
macOS tar is bsdtar/libarchive, which detects compression itself. GNU tar
would need --zstd, and a build of tar without zstd support would still fail,
so the error may be worth keeping for that case. I have not written or tested a
patch.
Workaround, for anyone hitting this in CI
r-lib/actions/setup-r routes macOS through Posit Package Manager only for a
fixed list of repository owners unless use-public-rspm: always is set. Setting
it restores gzip binaries and made our matrix green again. That depends on Posit
Package Manager keeping gzip, so it is a stopgap rather than a fix.
Environment
- Failure: GitHub Actions
macos-latest(macOS Tahoe 26.6.2), aarch64-apple-darwin23,
R 4.6.1 (2026-06-24), pak 0.11.1 viar-lib/actions/setup-r-dependencies. - Reproduction above: Linux x86_64, R 4.6.0 (2026-04-24), pkgdepends 0.9.1.
Limits
I have not established when CRAN changed compression or which builder made the
change, and I sampled five packages rather than surveying the repository.
Windows binaries are .zip and source installs are unaffected. I have not
checked whether other consumers of these archives, such as renv or
install.packages() with a custom method, are affected.
Prepared with Claude Opus 5 in Claude Code.
Activity
gaborcsardi commentedon Sep 20, 2026
Possible workaround is to force using PPM:
sounkou-bioinfo commentedon Sep 20, 2026
yeah, i ve already applied this workaround and it works
gaborcsardi commentedon Sep 20, 2026
Let's see if this was intentional and if there is already a roadmap:
https://stat.ethz.ch/pipermail/r-sig-mac/2026-September/015387.html
Route macOS binaries through RSPM to avoid zstd .tgz
ci: force public RSPM to dodge zstd macOS binaries
ci: point CRAN at PPM so macOS pak resolves gzip binaries
ci: set R_PROFILE_USER so pak resolves PPM on macOS
Take macOS binaries from PPM while CRAN ships zstd archives
Hand off a Delphi workflow to empirical validation (#43)
fix(ci): build the macOS binaries pak cannot extract from source
Take the packages from the public Posit Package Manager
fix(ci): install the macOS dependencies with base R
[v0.2.1] nomo_report() renders from inside a knitted R Markdown or Qu…
Take macOS check dependencies from Posit Package Manager
Install the macOS job's dependencies with base R
17 remaining items
Take the macOS dependencies from Posit Package Manager
Take the macOS dependencies from Posit Package Manager
Take the macOS dependencies from Posit Package Manager
Give the package continuous integration
ci: take macOS binaries from Posit Package Manager
Install macOS dependencies from Posit Package Manager
gaborcsardi commentedon Sep 21, 2026
Apparently this is a CRAN bug:
https://stat.ethz.ch/pipermail/r-sig-mac/2026-September/015389.html
Nevertheless I am going to switch over the default to PPM on macOS as well, as it seems to we working well and it also fixes this issue.
CI: install macOS dependencies without pak
ci: install macOS dependencies without pak
CI: force macOS through PPM to avoid CRAN zstd binary extraction failure
ci(macos): block mac.cran.dev so pak installs PPM's gzip binaries
ci(r): cache the R library and build adbcdrivermanager from source on…
ci(r): cache the R library and build adbcdrivermanager from source on…
Prepare the 0.2.0 submission to CRAN
Replace the CI with a self-contained rcc workflow