Skip to content

Latest commit

 

History

History
60 lines (40 loc) · 1.33 KB

File metadata and controls

60 lines (40 loc) · 1.33 KB

hostname

Swift 6.0 macOS 14+ License: MIT

View and manage all three macOS hostname types — HostName, LocalHostName, and ComputerName.

hostname

What it does

macOS maintains three separate hostname values, each used in different contexts:

Type Used by
HostName Terminal prompt, SSH
LocalHostName Bonjour, AirDrop discovery
ComputerName Finder sidebar, file sharing

Running hostname without arguments shows all three. Passing a new name sets all three at once via scutil and flushes the DNS cache.

Install

brew install ansilithic/tap/hostname

Or build from source (requires Xcode and macOS 14+):

make build && make install

Usage

USAGE: hostname [<new-hostname>]

ARGUMENTS:
  <new-hostname>          New hostname to set (omit to show current)

OPTIONS:
  --version               Show the version.
  -h, --help              Show help information.

Examples

# Show current hostnames
hostname

# Set all three hostnames at once (requires sudo)
hostname MacBook

License

MIT