option

networking.localHostName

The local hostname, or local network name, is displayed beneath the computer's name at the top of the Sharing preferences pane. It identifies your Mac to Bonjour-compatible services. Setting this option is equivalent to running the command `scutil --set LocalHostName`, where running, e.g., `scutil --set LocalHostName 'Johns-MacBook-Pro'`, would set the systems local hostname to "Johns-MacBook-Pro.local". The value of this option defaults to the value of the networking.hostName option. By default on macOS the local hostname is your computer's name with ".local" appended, with any spaces replaced with hyphens, and invalid characters omitted.

Declarations
Type
null or string matching the pattern ^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$
Default
null
Example
"Johns-MacBook-Pro"