无需dpkg工具在MacOS High Sierra中打开Debian deb包
Got it, let's figure this out for you. Debian .deb packages aren't standard tar or zip archives—they're actually ar-format archives with a specific internal structure, which is why tar and unzip aren't working. Here's how to extract the contents (and get to those binary files you need to compare) on macOS High Sierra, using both command line and GUI methods:
Command Line Methods
Option 1: Use macOS's built-in ar tool
macOS comes with the ar command preinstalled, which can handle the ar-format structure of .deb packages:
- Open Terminal and navigate to the folder where your
mssql-server_14.0.3008.27-1_amd64.debfile is stored. - Run this command to extract the core components of the package:
This will create three files in your current directory:ar x mssql-server_14.0.3008.27-1_amd64.debdebian-binary: A plain text file with the package format versioncontrol.tar.gz: Contains package metadata and setup scriptsdata.tar.xz(ordata.tar.gz, depending on the package): This is the archive holding all the actual binary files and system files you care about.
- Next, extract the data archive. If it's
.xzcompressed, use:
If it'star xJf data.tar.xz.gzcompressed, use:
You’ll now have a directory structure matching what would be installed on a Linux system, with all the binaries ready for comparison.tar xzf data.tar.gz
Option 2: Install dpkg via Homebrew for simpler extraction
If you have Homebrew installed (a popular package manager for macOS), you can use dpkg (the official Debian package tool) to extract the .deb directly into a clean, organized folder:
- Install
dpkgif you don’t already have it:brew install dpkg - Extract the package to a target directory (replace
./mssql-extractedwith any path you prefer):
This will automatically unpack all binary files into the same directory hierarchy they use on Linux, so you can jump straight into comparing with your installed version.dpkg-deb -x mssql-server_14.0.3008.27-1_amd64.deb ./mssql-extracted
GUI Method (No Terminal Needed)
If you prefer a graphical approach, The Unarchiver (a free, widely used macOS app) supports .deb files out of the box:
- Download and install The Unarchiver from the Mac App Store.
- Right-click your
.debfile, select "Open With" > "The Unarchiver". - Choose a destination folder, and the app will extract all contents (including the binary files from the data archive) for you to browse.
内容的提问来源于stack exchange,提问作者Rui F Ribeiro

