mac
Configure macOS system preferences, Dock, Finder, hot corners, and more.
lua
local mac = require("rootbeer.mac")
mac.dock({
autohide = true,
tile_size = 48,
position = "bottom",
show_recents = false,
minimize_effect = "scale",
})
mac.finder({
show_extensions = true,
show_hidden = true,
show_path_bar = true,
default_view = "list",
search_scope = "current",
})
mac.hot_corners({
top_right = "notification_center",
bottom_left = "lock_screen",
})
mac.input({
tap_to_click = true,
key_repeat_rate = 2,
initial_key_repeat = 15,
})
mac.hostname({ name = "my-mac" })
mac.touch_id_sudo()For one-off preferences not covered by the helpers above, use mac.defaults() directly:
lua
mac.defaults({
{ domain = "com.apple.LaunchServices", key = "LSQuarantine", type = "bool", value = false },
{ domain = "NSGlobalDomain", key = "NSAutomaticSpellingCorrectionEnabled", type = "bool", value = false },
})defaults(entries)
Writes macOS defaults entries. Each entry runs defaults write domain key -type value.
entriesmac.DefaultEntry[]dock(cfg)
Configures the macOS Dock and restarts it to apply changes.
autohidebooleanoptionalAuto-hide the Dock. Defaults to
false.autohide_delaynumberoptionalDelay before showing the Dock (seconds). Only applies when
autohide is true.large_sizenumberoptionalMagnified icon size in pixels. Only applies when
magnification is true.magnificationbooleanoptionalEnable icon magnification on hover.
minimize_effect("genie"|"scale"|"suck")optionalWindow minimize animation.
minimize_to_appbooleanoptionalMinimize windows into their app icon.
position("bottom"|"left"|"right")optionalScreen edge for the Dock.
show_recentsbooleanoptionalShow recent applications section.
tile_sizenumberoptionalIcon size in pixels (16–128).
finder(cfg)
Configures macOS Finder and restarts it to apply changes.
default_view("column"|"gallery"|"icon"|"list")optionalDefault Finder view style.
search_scope("current"|"mac"|"previous")optionalDefault search scope.
show_extensionsbooleanoptionalAlways show file extensions.
show_hiddenbooleanoptionalShow hidden files.
show_path_barbooleanoptionalShow the path bar at the bottom.
show_status_barbooleanoptionalShow the status bar at the bottom.
hostname(cfg)
Sets the macOS hostname via scutil. Sets ComputerName, HostName, and LocalHostName. Requires sudo to take effect.
namestringThe hostname to set (used for ComputerName, HostName, and LocalHostName).
hot_corners(cfg)
Configures macOS hot corners.
bottom_left("app_windows"|"desktop"|"disable_screensaver"|"disabled"|"display_sleep"...(+6))optionalAction for bottom-left corner.
bottom_right("app_windows"|"desktop"|"disable_screensaver"|"disabled"|"display_sleep"...(+6))optionalAction for bottom-right corner.
top_left("app_windows"|"desktop"|"disable_screensaver"|"disabled"|"display_sleep"...(+6))optionalAction for top-left corner.
top_right("app_windows"|"desktop"|"disable_screensaver"|"disabled"|"display_sleep"...(+6))optionalAction for top-right corner.
input(cfg)
Configures macOS input preferences (keyboard and trackpad).
initial_key_repeatnumberoptionalDelay before key repeat starts (lower = shorter, default is 25).
key_repeat_ratenumberoptionalKey repeat rate (lower = faster, default is 6).
natural_scrollingbooleanoptionalNatural (content tracks finger) scrolling direction.
tap_to_clickbooleanoptionalEnable tap-to-click on trackpad.
touch_id_sudo()
Enables Touch ID for sudo by writing /etc/pam.d/sudo_local. This is the Apple-recommended method that persists across macOS updates. Requires sudo to take effect.
mac.DefaultEntry
domainstringThe defaults domain (e.g.
"com.apple.dock", "NSGlobalDomain").keystringThe preference key.
type"bool"|"float"|"int"|"string"The value type.
valueboolean|string|numberThe value to set.