39

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.

daviesgeek
  • 38,901
  • 52
  • 159
  • 203
Thomas
  • 2,830
  • 6
  • 30
  • 33

7 Answers7

70

ar is already installed on my mac on OS X. So just do

ar -x path/to/deb/file.deb

that's it. No need to install other software.

topskip
  • 1,142
  • 1
    Users of XCode 4 can run /Applications/Xcode.app/Contents/Developer/usr/bin/ar. – zpletan Apr 02 '13 at 18:19
  • @zpletan Why not /usr/bin/ar ? – topskip Apr 02 '13 at 20:46
  • 1
    ar comes from XCode (unless you installed it with MacPorts/Homebrew/etc), but XCode 4 comes from the App Store and therefore doesn't install anything in /usr/bin by default. I think you can change it from preferences, but that's the default. – zpletan Apr 03 '13 at 15:58
  • @zpletan I've never installed anything in /usr/bin, so ar must be from the default installation. (Unless I am totally mistaken.) – topskip Apr 03 '13 at 20:09
  • @zpletan I've just checked: /usr/bin/ar is installed via the package DeveloperToolsCLI, which is probably an optional install (but I wonder where I chose to install these tools) – topskip Apr 03 '13 at 20:30
  • All I know is, I followed the Internet's instructions to uninstall v3 and then installed v4, and now I can only get to it via the path I posted. Like I said, I think there is an optional install in prefs that puts all XCode's stuff in /usr/bin, but it's optional. – zpletan Apr 05 '13 at 00:41
  • 2
    This doesn’t generally work. I’ve got a .deb file that unpacks beautifully with dpkg but ar fails because it thinks the package contains a different set of folders, with different names, than it actually contains. – Konrad Rudolph Oct 12 '17 at 10:58
4

While not OSX specific, if you have Docker for Mac installed, you could use an Ubuntu container to look inside the contents of the package:

docker run -it -v $(pwd):/data ubuntu:latest /bin/bash
dpkg -c /data/foo.deb
B00TK1D
  • 103
spuder
  • 528
4

You can install dpkg using MacPorts or just download the sources.

Studer
  • 8,779
  • 5
  • 38
  • 38
1

At least on recent macOS versions, you can also use tar to extract UNIX archives:

tar xf package.deb
nwellnhof
  • 111
1

if you use MacPorts you can install dpkg and more package (like do it in debian or ubuntu).

after installing Macports go and install dpkg from here.

also you can find more info about dpkg in osx here. (This is now down - I don't know if temporarily or permanently)

mmmmmm
  • 30,160
Am1rr3zA
  • 13,219
  • 14
  • 68
  • 88
0
brew install dpkg
dpkg -c file.deb # This will give you contents list
dpkg -x file.deb # This will extract
-1
docker run -it -v $(pwd):/data ubuntu:latest /bin/bash
# or with fish
# docker run -it -v (pwd):/data ubuntu:latest /bin/bash
cd data
dpkg -x wkhtmltox_0.12.6-1.focal_amd64.deb out
ls out/usr/local/bin/

works well for wkhtmltoimage and wkhtmltopdf

Dorian
  • 107
  • This is the same as https://apple.stackexchange.com/a/418659/237 or if extra information it should be an edit to that – mmmmmm May 01 '22 at 16:40
  • @mmmmmm it's dpkg -x not dpkg -c – Dorian May 02 '22 at 17:18
  • Then I think it would make sense to describe why it is different and the benefit. People shouldn't be copying code without understanding it so an explanation should always be given – mmmmmm May 02 '22 at 18:12