Hammerspoon

Free automation tool for Mac that lets you script hotkeys, windows and apps in Lua.

Alternative toKeyboard Maestro
Try App

Hammerspoon is a desktop automation tool for macOS. It links the system to a Lua scripting engine, and its extensions give your scripts access to hotkeys, windows, screens, alerts, notifications, file changes and more.

Out of the box it does nothing. You write your setup in ~/.hammerspoon/init.lua, open it from the menu bar icon with Open Config, and pick Reload Config after each change. A first script might use hs.hotkey.bind to show an alert when you press Command-Option-Control-W, or use hs.window.focusedWindow() and setFrame to move the front window to half of the screen. Spoons are ready-made plugins that you load with hs.loadSpoon, and the ReloadConfiguration Spoon reloads your setup whenever the files change.

It suits people who are happy to write a little code and want one tool for window layouts, hotkeys and small automations. The getting started guide, API docs and shared sample configs give you plenty to copy from.

Hammerspoon is free and open source under the MIT license. It began as a fork of Mjolnir with the extensions built in. Version 1.1.1 needs macOS 13 or later, and it asks for Accessibility access on first launch.

Frequently asked questions

Is Hammerspoon free?

Yes. Hammerspoon is free and has no paid version.

Is Hammerspoon safe and open source?

Hammerspoon is open source under the MIT license, and its code is developed in public on GitHub. It only runs the Lua code you put in your own config, so review any script you copy before you load it.

How do I install Hammerspoon?

Download the latest release zip from GitHub and drag Hammerspoon.app to Applications, or run brew install --cask hammerspoon in Terminal. Then grant Accessibility access and create ~/.hammerspoon/init.lua.

What macOS version does Hammerspoon need?

Hammerspoon 1.1.1 needs macOS 13 or later.

How does Hammerspoon compare to Keyboard Maestro?

Keyboard Maestro is a paid app, a one-time $36 purchase with a free trial, that builds macros from hundreds of ready-made actions with conditions and loops. Hammerspoon has no action library to pick from; everything is Lua code. That makes it very flexible for people who code and harder to start with for people who do not.

How do I reload my Hammerspoon config automatically?

Load the ReloadConfiguration Spoon with hs.loadSpoon("ReloadConfiguration") and then call spoon.ReloadConfiguration:start(). You can also bind a hotkey to hs.reload(), or choose Reload Config from the menu bar icon.

Gallery

No images yet.

Alternatives to Hammerspoon

Other Mac apps that do the same job as Hammerspoon.

More in Utilities

View all