gitwtfhub

wtf is networklocationmanager.spoon?

tzioup/networklocationmanager.spoon — explained in plain English

Analysis updated 2026-05-18

0LuaAudience · developerComplexity · 2/5LicenseSetup · moderate

TL;DR

A Hammerspoon plugin for Mac that automatically switches macOS Network Locations based on which WiFi network you are connected to.

Mindmap

mindmap
  root((NetworkLocationManager))
    What it does
      Auto switches Network Locations
      Detects WiFi by SSID
      Falls back to gateway MAC
    Tech stack
      Lua
      Hammerspoon
      macOS CoreWLAN
    Use cases
      Static home IP for port forwarding
      Self hosted services
      VPN and DNS per location
    Audience
      Mac power users
      Developers
    Setup
      Install Hammerspoon
      Create Network Locations
      Grant Location Services

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Why would anyone build with this?

REASON 1

Automatically get a static local IP at home for port forwarding while using DHCP everywhere else.

REASON 2

Switch VPN or DNS configuration automatically based on which WiFi network you join.

REASON 3

Keep self-hosted services like Plex or a game server reachable at a fixed home IP.

What's in the stack?

LuaHammerspoonmacOS

How it stacks up

tzioup/networklocationmanager.spoonalerque/silex.sileallquixotic/esoguildactivityaddon
Stars0
LanguageLuaLuaLua
Last pushed2025-04-172019-05-28
MaintenanceStaleDormant
Setup difficultymoderatemoderatemoderate
Complexity2/53/52/5
Audiencedeveloperdevelopergeneral

Figures from each repo's GitHub metadata at analysis time.

How do you spin it up?

Difficulty · moderate Time to first run · 30min

Requires Hammerspoon installed, macOS 14 or newer, and granting Location Services permission for reliable SSID detection.

Use freely for any purpose, including commercial use, as long as you keep the copyright notice.

Wtf does this do

NetworkLocationManager.spoon is a plugin, called a Spoon, for a Mac automation tool named Hammerspoon. It solves a specific annoyance for people who need a fixed local IP address on their home WiFi network, for example to set up port forwarding or run a self hosted service, but want their Mac to fall back to normal automatic addressing everywhere else. macOS already has a feature called Network Locations for switching between these setups, but switching manually every time you leave or return home is easy to forget. The README explains that every common command line way of reading the current WiFi network name on recent macOS is broken or blocked in some way, so this Spoon instead uses Hammerspoon's own WiFi module, which talks to the operating system's WiFi framework directly and only needs a one time Location Services permission grant. When that permission is not available, it falls back to identifying the network by your router's hardware address instead, though switching takes a few seconds longer that way. Setup involves creating the Network Locations you want inside macOS system settings, for example a Home location with a static IP, and then telling the Spoon which WiFi network names map to which location, either directly in your Hammerspoon configuration file or through a separate JSON file. The Spoon watches for WiFi changes, network reachability changes, and also checks on a timer, then switches locations automatically when it detects a match. A short cooldown period after each switch stops it from repeatedly re-triggering itself. The README lists example use cases such as peer to peer file sharing apps, home media servers, VPN configuration per location, and switching DNS providers depending on where you are. It requires macOS 14 or newer and Hammerspoon installed, and is released under the MIT license.

Yoink these prompts

Prompt 1
Walk me through installing NetworkLocationManager.spoon and setting up my first Network Location in macOS.
Prompt 2
Help me write the Lua config to map my home WiFi SSID to a static IP location.
Prompt 3
Explain why this Spoon uses Hammerspoon's WiFi module instead of the standard macOS command line tools.
Prompt 4
How do I set up the JSON config file instead of editing my Hammerspoon init.lua directly?

Frequently asked questions

wtf is networklocationmanager.spoon?

A Hammerspoon plugin for Mac that automatically switches macOS Network Locations based on which WiFi network you are connected to.

What language is networklocationmanager.spoon written in?

Mainly Lua. The stack also includes Lua, Hammerspoon, macOS.

What license does networklocationmanager.spoon use?

Use freely for any purpose, including commercial use, as long as you keep the copyright notice.

How hard is networklocationmanager.spoon to set up?

Setup difficulty is rated moderate, with roughly 30min to a first successful run.

Who is networklocationmanager.spoon for?

Mainly developer.

View the repo → Decode another repo

This repo across BitVibe Labs

Don't trust strangers blindly. Verify against the repo.