MacPorts Notes

The these are some general notes about MacPorts.


Commonly Used Ports (x86 / M1)

  1. autoconf (for autoreconf): https://www.gnu.org/software/autoconf/
  2. automake (to support autoreconf): https://www.gnu.org/software/automake/
  3. cargo2port (macports helper for Rust-based ports): https://github.com/l2dy/cargo2port
  4. cdrtools (make ISOs from CDs): http://cdrtools.sourceforge.net/private/cdrecord.html
  5. dnscrypt-proxy (encrypted dns): https://github.com/DNSCrypt/dnscrypt-proxy
  6. dosbox-x (enhanced dosbox): https://dosbox-x.com/
  7. epy (cli ebook reader): https://github.com/wustho/epy
  8. gh (git hub CLI): https://docs.github.com/en/github-cli/github-cli/about-github-cli
  9. gnupg2 (GNU pretty good privacy): https://www.gnupg.org/
  10. innoextract (extract files from Windows installers): https://constexpr.org/innoextract/
  11. libpst (extract files from Outlook PST archives): https://www.five-ten-sg.com/libpst/
  12. ncftp (terminal based ftp client): http://www.ncftpd.com/ncftp/
  13. newsboat (terminal based RSS reader): https://newsboat.org/
  14. oksh (portable version of OpenBSD's ksh): https://github.com/ibara/oksh
  15. py-pipdeptree (python dependencies): https://pypi.org/project/pipdeptree/
  16. qemu (multi-architecture emulator): https://www.qemu.org/
  17. rclone (sync files to cloud services): https://rclone.org/
  18. shellcheck (check the syntax of shell scripts): https://www.shellcheck.net/
  19. slrn (Usenet news reader): https://slrn.info/
  20. smartmontools (get SMART status for drives): https://www.smartmontools.org/
  21. tig (terminal based git history browser): https://jonas.github.io/tig/
  22. tuir (terminal based reddit browser): https://gitlab.com/ajak/tuir
  23. unshield (extract Installshield archives): https://github.com/twogood/unshield
  24. xorriso (cd tools): https://www.gnu.org/software/xorriso/

Checking which Port provides a file

$ port provides [file]

Contributing to MacPorts

  1. Create a fork on GitHub

  2. Clone the fork locally:
    $ git clone https://github.com/username/macports-ports.git
    where username your github username.

  3. Add the official repository as the upstream:
    $ git remote add upstream https://github.com/macports/macports-ports.git
  4. On GitHub, update the fork to include any upstream changes, for example:

    $ gh repo sync username/macports-ports
    where username your github username.

    See: GitHub Docs, Syncing a fork

  5. Fetch upstream changes locally:
    $ git fetch upstream && git pull
  6. Create a branch for changes:
    $ git checkout -b portname-version
    where portname is the name of the port and version is the version of the port

  7. After making changes, lint the Portfile:
    $ port lint --nitpick -D .
  8. Commit the changes:
    $ git commit -a -m "portname: update to version" [-S]
    where portname is the name of the port, version is the version of the port, and -S is optional (assuming that signing commits is enabled)

  9. Push the changes upstream:
    $ git push --set-upstream origin portname-version
    where portname is the name of the port and version is the version of the port
  10. Open a pull request on GitHub

  11. If changes are requested, make the changes, lint the Portfile (see above), and then override the prior commit:
    $ git commit --amend -a -m "portname: update to version" [-S]
    $ git push origin -f
    where portname is the name of the port, version is the version of the port, and -S is optional (assuming that signing commits is enabled).

    If the changes require the branch to be rebased to the master, then do the following before amending the prior commit:
    $ git pull --rebase origin master
    See: https://stackoverflow.com/questions/7929369/.

  12. Switch back to the main/master branch:
    $ git checkout master
  13. Once the pull request is merged, delete the local and remote branches:

    • Delete the local branch:
      $ git branch -D portname-version
      where portname is the name of the port and version is the version of the port

    • Delete the remote branch:
      $ git push origin --delete portname-version
      where portname is the name of the port and version is the version of the port

    • Synchronize local and remote branches:
      $ git fetch -p

Making ISO images

  1. Install cdrools:
    $sudo port install cdrtools
  2. Make a mount point for the cd, if it doesn't exist:
    $ sudo mkdir /Volumes/cdrom
  3. Find the non-Mac/HFS partition/slice on the cd using diskutil list (often it is slice 1)

  4. Mount the non-Mac/HFS partition on the cdrom:
    $ sudo mount_cd9660 -r /dev/disk[X]s[Y] /Volumes/cdrom
    where X is the disk number for the cd shown by diskutil list and Y is the slice number for the cd shown by diskutil list.

  5. Create the ISO image using mkisofs from cdrtools:
    $ mkisofs -v -J -r -V [VOLNAME] -o [ISO PATH] /Volumes/cdrom
    where VOLNAME is the volume name for the ISO and ISO PATH is the location where the ISO should be saved.

  6. Unmount the cd:
    $ umount /Volumes/cdrom
  7. Eject the cd:
    $ diskutil eject /dev/disk[X]
    where X is the disk number shown by diskutil list.
Based on: https://lists.macports.org/pipermail/macports-users/2022-April/051105.html

Home / Notes