When you copy a binary into root/, it retains its Unix permissions. But if you rebuild from a source that doesn't preserve the executable bit, the installed file will be non-executable. Always chmod 755 on binaries and chmod 644 on conf files before building.

A user named Sarah downloaded the new Pkg. In the old days, she would have had to unzip Bin, move him, and hope he worked. But not today.

She typed: sudo apt install ./prime-calculator_1.0_amd64.deb

The Package Manager read Pkg's manifest. It checked the database. "Ah," the Manager said, "This package requires libmath. I shall fetch it."

Once the dependencies were satisfied, Pkg unfolded. He gently placed Bin into /usr/bin, right where he belonged. He placed the config file into /etc.

Sarah typed prime-calculator into her terminal. It worked instantly. Bin was running, but he was safe now. He was tracked, he was managed, and he could be cleanly removed with a single command if he was ever no longer needed.

Your binary works on your dev machine, but after packaging, it fails. Why? Dynamic linking. Your .bin might expect libfoo.so in /usr/local/lib. The target machine doesn't have it.

Inside the mounted volume, look for:

If you find an existing .pkg inside the BIN, your job is done – no conversion needed; simply extract it.

A .pkg file is a software package, primarily for macOS and Solaris.

The critical insight: You do not convert a BIN file into a PKG file. You extract the contents of the BIN file (if they are software files) and then repackage those contents as a PKG.


if echo "$file_type" | grep -q "ISO 9660"; then echo "Detected disc image. Mounting and extracting..." mountpoint="/tmp/bin_mount_$$" mkdir -p "$mountpoint" hdiutil attach -mountpoint "$mountpoint" "$INPUT_BIN" pkgbuild --root "$mountpoint" --identifier "com.bin2pkg.discimage" --version 1.0 "$OUTPUT_PKG" hdiutil detach "$mountpoint" rm -rf "$mountpoint" exit 0 fi

On older Linux and macOS systems, software distributors often shipped a .bin file that was a shell script + compressed tar archive (makeself). For example, jdk-6u23-macosx-x64.bin.

Goal: Extract the contents of this self-extracting BIN and package it as a modern PKG.

If the disc contains a folder like AppName/ with binaries, frameworks, and resources, you will create a PKG, not "convert" the BIN.

Create a PKG from the extracted folder:

# Using pkgbuild (built into macOS)
pkgbuild --root /Volumes/MyDisc/MyAppFolder \
         --identifier com.mycompany.myapp \
         --version 1.0 \
         --install-location /Applications/MyApp \
         MyApp.pkg

Now you have turned the data from the BIN into a PKG.


Bin To Pkg May 2026

When you copy a binary into root/, it retains its Unix permissions. But if you rebuild from a source that doesn't preserve the executable bit, the installed file will be non-executable. Always chmod 755 on binaries and chmod 644 on conf files before building.

A user named Sarah downloaded the new Pkg. In the old days, she would have had to unzip Bin, move him, and hope he worked. But not today.

She typed: sudo apt install ./prime-calculator_1.0_amd64.deb

The Package Manager read Pkg's manifest. It checked the database. "Ah," the Manager said, "This package requires libmath. I shall fetch it."

Once the dependencies were satisfied, Pkg unfolded. He gently placed Bin into /usr/bin, right where he belonged. He placed the config file into /etc. bin to pkg

Sarah typed prime-calculator into her terminal. It worked instantly. Bin was running, but he was safe now. He was tracked, he was managed, and he could be cleanly removed with a single command if he was ever no longer needed.

Your binary works on your dev machine, but after packaging, it fails. Why? Dynamic linking. Your .bin might expect libfoo.so in /usr/local/lib. The target machine doesn't have it.

Inside the mounted volume, look for:

If you find an existing .pkg inside the BIN, your job is done – no conversion needed; simply extract it. When you copy a binary into root/ ,

A .pkg file is a software package, primarily for macOS and Solaris.

The critical insight: You do not convert a BIN file into a PKG file. You extract the contents of the BIN file (if they are software files) and then repackage those contents as a PKG.


if echo "$file_type" | grep -q "ISO 9660"; then echo "Detected disc image. Mounting and extracting..." mountpoint="/tmp/bin_mount_$$" mkdir -p "$mountpoint" hdiutil attach -mountpoint "$mountpoint" "$INPUT_BIN" pkgbuild --root "$mountpoint" --identifier "com.bin2pkg.discimage" --version 1.0 "$OUTPUT_PKG" hdiutil detach "$mountpoint" rm -rf "$mountpoint" exit 0 fi

On older Linux and macOS systems, software distributors often shipped a .bin file that was a shell script + compressed tar archive (makeself). For example, jdk-6u23-macosx-x64.bin. If you find an existing

Goal: Extract the contents of this self-extracting BIN and package it as a modern PKG.

If the disc contains a folder like AppName/ with binaries, frameworks, and resources, you will create a PKG, not "convert" the BIN.

Create a PKG from the extracted folder:

# Using pkgbuild (built into macOS)
pkgbuild --root /Volumes/MyDisc/MyAppFolder \
         --identifier com.mycompany.myapp \
         --version 1.0 \
         --install-location /Applications/MyApp \
         MyApp.pkg

Now you have turned the data from the BIN into a PKG.