Anyone using Hammerspoon?

Anyone here using Hammerspoon? Can it do anything Keyboard Maestro can’t?


Seems like a really cool scripting language for MacOS!

The major difference here is that Keyboard Maestro has a GUI (is drag and drop) while HammerSpoon seems to be purely code from my quick glance.

Based on that, I would say it can do just about everything Keyboard Maestro could do but requires that you have a deeper understanding when it comes to logic and coding :nerd_face:


Hi, I am not a Keyboard Maestro user, but I think it cannot create menubar entries, while Hammerspoon can.

I am using hammerspoon quite a bit. The only time I wished I had Keyboard Maestro was the image recognition to automate clicking a button (whose functionality didn’t have a menubar item).

Otherwise they are pretty similar in functionality (I think). Like @Dillon_Carter said, hammerspoon is purely code, while keyboard Maestro is mainly graphical with the ability to execute code.

My entry to hammerspoon was the desire to create a hyperkey, which gives you another (or more) layer of keyboard shortcuts. If you’re interested check out Brett Tepstra‘s version, and then google some. I don‘t need Karabiner, for example, and there are a lot of quite elaborated setups.

Nope. Keyboard Maestro is the observable universe. It’s everything we’ve ever conceived of seeing. Hammerspoon is that plus the stuff that light hasn’t had sufficient time to travel for us to know it’s there. (Objective-C and Swift are dark matter and dark energy in this weird analogy.)


Could you be a little more, uh, concrete? I’m reluctant to invest the time and effort in learning a fairly obscure language unless I have a better idea of the payoff. @Nils mentioned menubar items (which I already create with Butler, and tbh probably have way too many of as it is). Anything else worth mentioning?

Come to think of it, maybe the question I really want to ask is not what HS can do that can’t be done in KM, but what it can do that can’t be done in AppleScript or AppleScriptObjectiveC.

If you think it’s a hassle, then it’s probably not for you :wink:

I never got to the point where I can just write an AppleScript, I always have to google because it is so quirky. Lua is also quite strange (coming from Python), but at least my first try is much closer to the final script.

I suggest you scroll through the Hammerspoon API and see if anything jumps out to you. Maybe even look at Spoons created by other users to get a feeling.
I‘d say that it is probably not so impressive, if you compare it to KM’s features. However, it you want to edit your automations in your favorite text editor, then definitely give it a try.

To give another (less metaphorical) take on’s answer, I’d like to quote from the docs

you can write Objective-C extensions to expose new areas of system functionality

so if that is your thing, then your Mac is the limit. Or you Objective-C skills…

I’ve been playing with hammerspoon recently. I love Keyboard Maestro, but I find I can get the AutoNation I need in hammerspoon much more quickly.

KM packs a lot into some of its action blocks, and I find it very uninintuitive sometimes the way a given block can do multiple fairly distinct things — figuring out how to get them to do what I want can be frustrating for me.

It helps that I do have experience writing code (mostly python, but also a little javascript, PhP, and some older languages like Basic and Tutor). Because lua is a compete language, if I can’t do something within hammerspoon itself, I can usually find a way to do it plain lua (even if that means just borrowing someone else’s function for list slicing or text splitting).

Anyway, if you like writing code more than moving visual blocks around, give hs a try. For now I’m using it alongside KM, but I find myself turning to it for new automations more and more.


Hi, what really throws me about Hammerspoon is that there seems to be really scant documentation or blog-posts or tutorials about how to incorporate AppleScript into the mix. I mean, I get it, it is supported, but how. There’s a link to an API doc but that has changed to this link, and I don’t see actual examples anywhere for this.

What I’m trying to do is boot up a deeplink to System Settings using macOS Ventura, directly to the Software Update tab in System Settings. I have the deeplink, but I can’t figure out 1) how to launch it with AppleScript 2) how to run AppleScript from within Hammerspoon.

I’m kinda getting ready to give up altogether on Hammerspoon, it just hasn’t been fun, ya know? And the lack of real-life examples (and what are these Spoons anyway?!) is really throwing me. I’ll stick with this for a while, because of the menubar possibilities, and hopefully I’ll get something going, but I’m starting to really worry.

I use Hammerspoon extensively. Mostly for putting keystrokes to URLs (including url schemes, not just websites). I’ve never used it for System Preferences, however, so I’m not sure I’ll be much help. (I’m also doing very little on the computer atm.)

I recall finding examples on the site, but for a lot of things, you may want to look at lua programming references. When I got stuck, it was often on that kind of thing rather than Hammerspoon per Dr.