Skip to content

offyotto/Locale

Repository files navigation

locale icon

Locale

Save groups of hostname-to-ip mappings and switch between them in one click. no terminal, no editing system files, no sudo.

download for mac · website · license

macos 14+ notarized mit license


what it is

locale is a native macos app for switching between named dns contexts. a context is a saved set of hostname-to-ip mappings, so you can point api.myapp.test at localhost for one project, at a staging box for another, and flip between them from the menu bar.

it does this through a sandboxed dns proxy network extension. locale never edits /etc/hosts, never runs a privileged helper, and never calls osascript. when a context is active, matching dns questions get the ip you configured and everything else forwards to your normal system dns.

locale main window with an active context

why it exists

the usual way to override a hostname on macos is to edit /etc/hosts by hand. that means sudo, a text editor, remembering to comment lines back out, and no clean way to keep separate setups for separate projects. locale keeps each setup as its own context and lets you switch with one click, and it leaves your real hosts file alone.

manual /etc/hosts locale
switch setups comment and uncomment by hand one click
separate projects all mixed in one file one context each
needs sudo yes no
touches system files yes no
revert manual switch to home context

features

  • named contexts for local dev, vpns, labs, and temporary debugging
  • add, disable, and remove host mappings per context
  • apply a context through the bundled dns proxy network extension
  • switch active contexts from the menu bar
  • revert to a clean home context to clear everything locale manages
  • import and export contexts as json
  • adaptive app icon that matches light and dark mode

locale menu bar popover creating a new context in locale

install

download the notarized build and drag it to applications:

on first launch, macos will ask you to allow the system extension in system settings. this is the dns proxy. locale cannot switch contexts without it.

build from source

./script/build_and_run.sh --verify

the app bundle is written to dist/Locale.app.

for a signed archive, open Locale.xcodeproj, select the LocaleApp scheme, and use product > archive. do not archive the swift package workspace directly, since package archives show up in organizer as generic xcode archives instead of macos app archives.

how it works

  • the main app writes the active context to shared app group defaults
  • LocaleDNSProxy reads the same app group data
  • matching dns questions receive the configured ip address
  • unmatched dns traffic forwards to your system dns servers

no osascript, no privileged helper, no direct /etc/hosts writes.

requirements

  • macos 14 or newer
  • to build and sign: xcode, the swift toolchain, and apple developer capabilities for app groups, system extensions, and the dns proxy network extension

license

mit, see LICENSE.

About

Switch named DNS contexts on macOS with a sandboxed DNS proxy.

Topics

Resources

License

Contributing

Security policy

Stars

5 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors