Bin To Pkg -
For teams converting a binary (e.g., from a Go or Rust build) into a .pkg on every release, automation is key.
Example GitHub Actions Workflow:
name: Build PKG from Binary
on:
release:
types: [created]
jobs:
build-pkg:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Download binary from release
run: |
mkdir -p root/usr/local/bin
curl -L -o root/usr/local/bin/mytool https://github.com/user/mytool/releases/latest/download/mytool
chmod 755 root/usr/local/bin/mytool
- name: Build PKG
run: |
pkgbuild --root root \
--identifier com.user.mytool \
--version $ github.event.release.tag_name \
--install-location / \
mytool.pkg
- name: Upload PKG to Release
uses: softprops/action-gh-release@v1
with:
files: mytool.pkg
./installer.bin --extract --target /path/to/extract
or
./installer.bin --noexec --keep
The Linux Way
Linux distributions understood this decades ago. They didn't distribute compiled binaries in tarballs for system utilities; they distributed .deb or .rpm files. This kept systems stable and consistent. bin to pkg
The Modern DevOps Way Even in the containerization era, the concept holds. A Docker container is essentially a "super-package." It wraps the binary and the operating system filesystem together. It is the ultimate evolution of Bin-to-Pkg. For teams converting a binary (e
Language Specifics
file_type=$(file -b "$INPUT_BIN")