Pkg: Bin To

Mp4moviez Official Website for Movies

Pkg: Bin To

After creating your .pkg, you can distribute it. macOS systems can install it by double-clicking and following the install prompts.

On macOS Catalina and later, installing an unsigned .pkg requires a right-click → "Open" dance.

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

If you re-install an older version over a newer one, pkgutil may block it. Use: bin to pkg

pkgutil --forget com.mycompany.mytool

before installing an older package.

PS4 requires a GPG signature (only for retail). For homebrew, use:

ps4-pkg-tool create my_game/ my_game.pkg --fake

Assume you have compiled ffmpeg into a standalone binary: ffmpeg.bin.

Goal: Create ffmpeg-cli.pkg that installs the binary to /usr/local/bin/ffmpeg and places a man page. After creating your

Step 1 – Directory structure:

ffmpeg_pkg/
├── root/
│   └── usr
│       ├── local
│       │   └── bin
│       │       └── ffmpeg          (from ffmpeg.bin, chmod 755)
│       └── share
│           └── man
│               └── man1
│                   └── ffmpeg.1    (man page)
├── scripts/
│   └── postinstall
└── Distribution (if using productbuild)

Step 2 – Create postinstall script (optional but common):

#!/bin/bash
# Ensure /usr/local/bin is in PATH
if ! grep -q "/usr/local/bin" /etc/paths; then
    echo "/usr/local/bin" >> /etc/paths
fi
exit 0

Make executable: chmod 755 scripts/postinstall

Step 3 – Build with pkgbuild:

pkgbuild --root ./root \
         --identifier com.ffmpeg.cli \
         --version 5.1.2 \
         --install-location / \
         --scripts ./scripts \
         ffmpeg-5.1.2.pkg

Step 4 – Verify:

pkgutil --payload-files ffmpeg-5.1.2.pkg
# Should list ./usr/local/bin/ffmpeg and ./usr/share/man/man1/ffmpeg.1

Step 5 – Sign & Notarize (for distribution outside Mac App Store):

# Sign
productsign --sign "Developer ID Installer" ffmpeg-5.1.2.pkg signed-ffmpeg.pkg

Since macOS doesn't natively mount raw .bin files, convert it first to an ISO (Standard disc image) or mount it virtually.

# Install bchunk via Homebrew
brew install bchunk
© Mp4Moviez 2026