When comparing MacPorts 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 37th while MacPorts is ranked 54th. 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 Provides a consistent experience across OS X versions
MacPorts eschews Apple-supplied libraries and links sources against its own making sure that the experience is the same regardless of what OS X version is used.
Pro Generally very up to date
MacPorts generally gets new software soon after it's available. This way users will not have to worry if their software is up to date.
Pro Nice variants system
MacPorts has a variants system that allows customizing builds with author provided options.
Written in Tcl & C, it's generally significantly faster than the competition. Tcl is also quite readable and comparable to Ruby, so it's also friendly to newcomers.
Pro Has many more packages than its competitors
As of this writing, 20K packages. 3 to 5x more than other current package managers.
Pro MacPorts is a native application: C + TCL
No need to install Ruby, or any other programming language.
Pro Requires SUDO to install apps
No need to worry if some rogue app will change your binaries or configuration.
Pro Most of the available packages work
For example, trying to install Finch using Pkgsrc doesn't work, while installing it using MacPorts works perfectly. Finch isn't even on Homebrew's radar.
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 Bad at limiting dependencies
MacPorts has a habit of pulling very specific versions of dependencies for each package. It downloads different version of already existing dependencies even in cases where the existing dependency version would have worked seamlessly.
Con Downloads unneeded libraries duplicating functionality already provided by Apple's libraries
As MacPorts eschews Apple-supplied libraries and links sources against its own a large duplication of functionality across MacPorts and Apple libraries can be found.
Con Requires root permissions (sudo) for installation of packages
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