This is a tool for powerful automation of macOS. At its core, Hammerspoon is just a bridge between the operating system and a JavaScript scripting engine.
What gives Hammerspoon its power is a set of modules that expose specific pieces of system functionality, to the user. With these, you can write JavaScript to control many aspects of your macOS environment.
The first version of Hammerspoon used Lua for its scripting engine, this is a modernized rewrite that uses the same JavaScript engine as Safari.
Hammerspoon 2 requires macOS 27 or later.
Hammerspoon 2.app from your Downloads folder to /Applicationshs.docs.show() in the Hammerspoon Console window.This is an Xcode project. Open Hammerspoon 2.xcodeproj in Xcode to build. To generate doc artifacts, run npm install in the top level of the repository.
The code is linted with SwiftLint (rules in .swiftlint.yml), which runs as a Swift package build tool plugin. The first time you build, Xcode asks you to trust and enable SwiftLintBuildToolPlugin. Command line builds need the same approval, or -skipPackagePluginValidation passed to xcodebuild.
See the LICENSE file for details.
This is a modernized rewrite of the original Hammerspoon project, and builds on projects such as: