Files
homepage/docs/en-gb/blog/contents/macos-private-dns-hostname.md
T
siujamo dbaf28ad98 feat: add tags to articles, full i18n coverage, and Tailwind CSS setup
- Add tag frontmatter to all 6 blog articles (3 articles × 2 locales)
- Complete i18n.json with all 26 text keys for en-gb and zh-hans
- Install and configure Tailwind CSS v4 with PostCSS
- Create Tags component using Tailwind utility classes
- Inject Tags into DocLayout via theme override
- Fix zh-hans homepage icon extension
2026-05-20 03:39:59 -05:00

1.8 KiB

title, tags
title tags
Fix macOS Terminal Host Name Showing IP Segments Under Private DNS
macos
dns
terminal

In some enterprise or home private network environments, reverse DNS lookups may resolve a device's private IP to a hostname starting with 192, 172, or 10. When this happens, the macOS terminal prompt changes from the normal user@MacBook-Pro to something like user@192-168-1-100, which can be distracting.

Cause

When starting a terminal session, macOS performs a reverse DNS lookup to determine the hostname for the current IP address. If the private DNS server returns a hostname derived from IP octets (e.g. 192-168-1-100.example.com), the system adopts it as the Host Name and the terminal prompt reflects it.

Fix

Use the built-in scutil (System Configuration Utility) to pin the Host Name to your preferred value.

Check Current State

# View the current Host Name (may be empty or overridden by DNS)
scutil --get HostName

# View the local Bonjour name
scutil --get LocalHostName

# View the computer name shown in Finder
scutil --get ComputerName

Set the Host Name

sudo scutil --set HostName "MacBook-Pro"

Prefer a name without spaces or special characters, such as MacBook-Pro, My-Mac, or your device serial number.

Verify

Open a new terminal window — the value after @ in the prompt should now show your chosen hostname.

scutil --get HostName
# Output: MacBook-Pro

Notes

  • HostName only affects the network-level hostname. LocalHostName (Bonjour) and ComputerName (Finder display) are managed independently.
  • If the issue returns after a reboot, check /etc/hosts for conflicting entries or verify whether the DHCP/DNS server continues to push an undesired hostname.