Skip to content

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

License

Notifications You must be signed in to change notification settings

ansilithic/hostname

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

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

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors