When comparing pkgsrc vs Hammerspoon, the Slant community recommends Hammerspoon for most people. In the question“What are the best power user tools for macOS?” Hammerspoon is ranked 34th while pkgsrc is ranked 48th. The most important reason people chose Hammerspoon is:
Hammerspoon's Lua scripting and broad API allows you to perform any action you can imagine on your mac. It hooks into many OS APIs directly and has some high-level APIs to manipulate things like Spotify or iTunes. See the full list [here](https://www.hammerspoon.org/docs/).
Ranked in these QuestionsQuestion Ranking
Pro pkgin is an apt-like tools for installing binaries from pkgsrc
pkgin aims to be a tool similar to apt/yum for managing pkgsrc binaries by relying on pkg_summary for installing, removing and upgrading packages and dependencies, using a remote repo.
Pro Adapted for use on over a dozen different operating systems
Has been adopted to be used on several Unix-like operating systems and Windows. It's also the default package manager of DragonflyBSD and of the (now discounted) Bluewall Linux distro.
Pro Easy installation if you use 3rd party scripts
I used this one and it worked brilliantly. https://github.com/cmacrae/savemacos
Pro Installs and works in the same way as MacPorts
Installs its own dependencies which means that it is very secure. Cannot install anything unless you use the "sudo" command which is in keeping with the Unix philosophy.
Pro Does not need Xcode command line tools or Xcode.
This means that you can install it fresh on a new installation of MacOS and have all your favorite apps installed right from the start.
Pro Works easily with Ansible
Can be used from within Ansible to install packages on macOS.
Pro Offering tooling for backporting fixes
Backporting fixes can be done by cherry-picking updates from a newer branch (pkgsrc is released every 3 months) and creating a package. Sometimes bugs need to be fixed for production and there is neither a fix in newer pkgsrc nor the softwares upstream. So pkgsrc has tools like pkgdiff, mkpatches, etc. that help with developing patches and building binary packages from that. A bit of documentation about that process can be found here.
Pro Both binary packages and source build possible
Fast software installation is possible by using binary packages. It's also easy to build from source which allows for different compile-time options (like different UI backends) as well as gaining access to pre-release versions of software in certain cases.
Pro Deeply customizable
Hammerspoon's Lua scripting and broad API allows you to perform any action you can imagine on your mac. It hooks into many OS APIs directly and has some high-level APIs to manipulate things like Spotify or iTunes. See the full list here.
Pro Automate actions based on the operating system
Hammerspoon lets you hook into OS level events and trigger any action you can imagine. From setting up a simple keyboard shortcut to launching a complex workflow using multiple apps and scripts.
Con Not so broadly used on MacOS as compared with MacPorts
You do not hear about Pkgsrc as openly as you hear the words "HomeBrew" or "MacPorts"
Con Can't install some packages
Even building well known packages (except MacPorts) from source using the ports can fail.
Con Relatively complicated setup and installation
Installing and setting pkgsrc up is a bit more complicated than in other package managers where it often consists in running a single script.
Con Some knowledge of programming required
Hammerspoon is scripted in the Lua programming language, and some familiarity with programming in general will be needed to use it. Some plugins exist that can be used by adding some files to a specific folder, but this will not give the flexibility that is so key to Hammerspoon