Skip to content

Instantly share code, notes, and snippets.

@laris
Last active January 13, 2024 16:58
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save laris/da75482431de70870bc3cb4bc6bce3d9 to your computer and use it in GitHub Desktop.
Save laris/da75482431de70870bc3cb4bc6bce3d9 to your computer and use it in GitHub Desktop.
unpack-extract-deb-macos.md

https://apple.stackexchange.com/questions/867/how-can-i-unpack-a-deb-on-mac-os-x-without-installing-it

How can I unpack a .deb on Mac OS X without installing it?

I have a .deb file that I want to unpack and examine, but not install. I'm currently looking for where i can download dpkg for OSX, but can't find it. If you have a link, please share.

  • ar -x path/to/deb/file.deb
  • brew install dpkg
dpkg: stable 1.19.0.5 (bottled)
Debian package management system
https://wiki.debian.org/Teams/Dpkg
/usr/local/Cellar/dpkg/1.19.0.5 (284 files, 5.7MB) *
  Poured from bottle on 2018-10-20 at 19:00:39
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/dpkg.rb
==> Dependencies
Build: pkg-config ✔
Required: gnu-tar ✔, gpatch ✔, perl ✔, xz ✔
==> Caveats
This installation of dpkg is not configured to install software, so
commands such as `dpkg -i`, `dpkg --configure` will fail.
==> Analytics
install: 1,289 (30 days), 3,921 (90 days), 20,708 (365 days)
install_on_request: 1,252 (30 days), 3,769 (90 days), 18,133 (365 days)
build_error: 0 (30 days)
  • MacPorts

How to extract deb package Distributions

Debuser 3 May '08 Debian packages are regular ar 591 archives. They contains three files:

debian-binary: regular text file, contains the version of the deb package format control.tar.gz: compressed file, contains file md5sums and control directory for the deb package data.tar.xz: compressed file, contains all the files which will be installed To unpack a .deb archive you can use following ar command with x parameter or if you want more verbose output, xv parameter as below:

$ ar x example.deb $ ar -xv example.deb x - debian-binary x - control.tar.gz x - data.tar.xz

If you are using a Debian based distribution or you have dpkg installed, you can also use dpkg to extract/unpack deb package without installing in your system:

$ dpkg -x package.deb /tmp/out You have to provide directory for unpack at the last parameter of the command.

When command finished, you will see the deb package contents in /tmp/out directory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment