I really dislike MacOS choosing machine names, and having the long machine names and short hostnames in separate places to change (one of them command-line only)
Posted by jpluimers on 2024/12/05
After installing my Apple Silicon MacBook, I found out my machine had gotten named automatically in two different ways:
- readable name Jeroen’s Macbook Pro
- full name Jeroens-MacBook-Pro
- local hostname Jeroens-MacBook-Pro.local
- actual
hostnameJeroens-MBP - HostName from
scutil
A few reasons I dislike that:
- Having 5 different names for the same machine creates a mess
- They chose for me where I like to choose myself
- They use spaces, quotes and hyphens where I like single a complete word
- They use mixed case where I like single case (preferably lower case) as not all other computers handle mixed case well
Finding out how to fix all this was a tedious job as I had to keep refining queries:
- [WaybackSave/Archive] macbook computer short name – Sök på Google
- [WaybackSave/Archive] macbook hostname change – Google Suche
- [WaybackSave/Archive] how to get the “.local” name of a Mac from the terminal – Google Suche
- [WaybackSave/Archive] wikipedia scutil – Google Suche
- [WaybackSave/Archive] scutil Manage system configuration parameters. – Google Suche
The results from these queries that actually helped me further:
- [Wayback/Archive] Change your computer’s name or local hostname on Mac – Apple Support (UK) which helped me change 1. and 2.:
Change your computer’s name
You can view and change your computer’s name in the About settings window.
- On your Mac, choose Apple menu > System Settings, click General ⚙ in the sidebar, then click About on the right. (You may need to scroll down.)
- Type a new name in the Name field.
This is confusing as the field does not look like it can be edited “in place”: a grey background like the other fields (which all are read-only), and just slightly bit darker text than the read-only fields.
Change your computer’s local hostname
…
The local hostname is your computer’s name with .local added, and any spaces are replaced with hyphens. For example, if your computer’s name is My Computer, your local hostname is My-Computer.local. Local hostnames aren’t case sensitive, so my-computer.local is the same as My-Computer.local.
- On your Mac, choose Apple menu > System Settings, click General ⚙ in the sidebar, then click Sharing on the right. (You may need to scroll down.)Open Sharing settings for me
- Click Edit in the “Local hostname” section at the bottom of the window, then enter a new local hostname.
- If needed, turn on the Use dynamic global hostname option. See Use a dynamic global hostname.
- Click OK.
This second setting at least has a decent “Edit…” button so it is clear that you can change it at all.
- [Wayback/Archive] network – Set the hostname/computer name for macOS – Ask Different which in the first answer failed to mention or fully quote the actual source (see below) in the answer, but had this useful comment:
sudo hostname <new-host-name>also sets hostname that can be used from terminal. It would be nice to see what is the difference and relations between these internal hostnames in MacOS and standard *nix hostnames (as @scrpy asked). Additionally,System Preferences -> Sharingis another place to change some hostname, so again, what is the diff to previous hostname settings?The second answer was more complete (restarting the Mac is needed because some software does not update itself automatically from the new hostnames):
You need to set the hostname in two places
- System Settings -> General -> About -> Name
- In a terminal,
sudo scutil --set HostName <new host name>
You can verify the hostname is correctly updated by doing:scutil --get HostName scutil --get LocalHostName scutil --get ComputerNameThen,dscacheutil -flushcacheand restart your mac.The source of the first answer:
[Wayback/Archive] How to set the Mac hostname or computer name from the terminal
Issue:
The hostname present in the Mac System Preferences is different to the one shown in the terminal.
The following error may also be seen:
Network License Error -96.7.1100
Environment:
macOS X
Solution:
This information can be useful when configuring your workstation remotely through ssh, or when you need to change the fully qualified hostname of the workstation (which can’t be done from the UI).Note: The following procedure is for informational purposes only and is not an Autodesk certified or supported workflow. Should issues arise with this procedure, they will not be addressed by Autodesk Customer Support.Perform the following tasks to change the workstation hostname using the scutil command.- Open a terminal.
- Type the following command to change the primary hostname of your Mac:
This is your fully qualified hostname, for example myMac.domain.com
sudo scutil --set HostName <new host name>
So for example:sudo scutil --set HostName flame01.domain.com
- Type the following command to change the Bonjour hostname of your Mac:
This is the name usable on the local network, for example myMac.local.
sudo scutil --set LocalHostName <new host name>
So for example:sudo scutil --set LocalHostName flame01
- Type the following command to change the computer name:
This is the user-friendly computer name you see in Finder, for example myMac.
sudo scutil --set ComputerName <new name>
So for example:sudo scutil --set ComputerName flame01
- Flush the DNS cache by typing:
dscacheutil -flushcache
- Restart Mac.
From that, I deduced these:
scutil --get HostName ; scutil --get HostName ; scutil --get HostName ; hostname; scutil --get LocalHostName ;aaaaaThis gets them in the order 1., 2., 4,. 5. where 4. actually returned it with the suffix set by the router:
Jeroens-MBP.fritz.box(this is still a problem as AVM should use.fritzbox.localbecause they initially didn’t own thefritz.boxtoplevel domain, and now that they own it still have not fixed it to point to your local Fritz!Box, see the links further below)The odd thing is that 3. is not available (meaning there seems to be no way to retrieve the name ending in
.local); neither is 5.:scutil --get LocalHostNamereturnsHostName: not set. - Likely at least generated in part from [WaybackSave/Archive] scutil.8 is [WaybackSave/Archive] scutil Man Page – macOS – SS64.com:
scutil
Manage system configuration parameters.Syntax Interface to the [raw] stored preference data:
…
Report and update a select group of persistent system preferences, e.g. Hostname: scutil --get pref scutil --set pref [newval] Report the current DNS configuration: scutil --dns Report the current system proxy configuration: scutil --proxy…
--get pref Retrieves the specified preference. The current value will be reported on standard output. Supported preferences include: ComputerName The user-friendly name for the system. LocalHostName The local (Bonjour) host name. HostName The name associated with hostname(1) and gethostname(3). --set pref [newval] Updates the specified preference with the new value. If the new value is not specified on the command line then it will be read from standard input. Supported preferences include: ComputerName LocalHostName HostName The --set option requires super-user access. --dns Reports the current DNS configuration. --proxy Reports the current proxy configuration.…
Display the current hostname, localhost name and computername:scutil --get HostName
scutil --get LocalHostName
scutil --get ComputerNameChange the primary hostname of the computer to cedric.local (local) or cedric.ss64.com (fully qualified):sudo scutil --set HostName cedric.local
sudo scutil --set HostName cedric.ss64.comChange the Bonjour hostname of the computer on the local network, to cedric:sudo scutil --set LocalHostName cedricChange the computer name to Cedric, this is the computer name you see in Finder:sudo scutil --set ComputerName Cedric…
Related macOS commands
- [Wayback/Archive] hostname Man Page – macOS – SS64.com
Print or Set (temporarily) the name of current host system.Syntax hostname [-fs] [name-of-host] Key -f Include domain information in the printed name. This is the default behavior. -s Trim off any domain information from the printed name.The super-user can set the hostname by supplying a hostname argument.…
- [Wayback/Archive] dscacheutil Man Page – macOS – SS64.com
Directory Service cache – Gather information, statistics, initiate queries, flush the cache.
dscacheutil replaces most of the functionality of thelookupd tool provided prior to OS X Leopard.Syntax dscacheutil -q category [-a key value] dscacheutil -cachedump [-buckets] [-entries [category]] dscacheutil -configuration dscacheutil -flushcache dscacheutil -statistics dscacheutil -h…
AVM and the fritz.box domain
By now at least AVM owns the fritz.box domain.
Initially they didn’t. This is a good start to read about that: [Wayback/Archive] Status of hijacked domain Fritz.box ? : fritzbox
It misses the current state links to these that show the current state (AVM owning the fritz.box domain):
- [WaybackSave/Archive] fritz.box whois lookup – who.is (new state) / [Wayback/Archive] fritz.box whois lookup – who.is (old state)
- [WaybackSave/Archive] au Godaddy WHOIS search results for fritz.box
- [Wayback/Archive] Internet gateway company faces name collision with .box – Domain Name Wire | Domain Name News
- [Wayback/Archive1/Archive2] FRITZ!Box on X: “@JohnLBevan @JohnLBevan We have good news for you, the domain
fritz.boxbelongs to AVM again – so everything stays as usual for our users. From the home network, users can access the interface of their FRITZ!Box as usual viafritz.box.”
More links in chronological order:
- [Wayback/Archive] Introducing .box – The World’s First Blockchain Native, DNS Routable Domain
- [Wayback/Archive] Verwirrend: Internet-Domain fritz.box zeigt NFT-Galerie statt Router-Verwaltung | heise online
- [Wayback/Archive] Fritz.box: Domain aus dem Verkehr gezogen | heise online
- [Wayback/Archive] Schiedsverfahren gewonnen: Domain “fritz.box” gehört nun AVM | heise online
Queries:
- [WaybackSave/Archive] “fritzbox.local” domain – Google Suche
- [WaybackSave/Archive] domaininfo fritz.box – Google Suche
- [WaybackSave/Archive] fritz.box domain heise – Google Suche (since Heise is the go to on-line IT media source in Germany)
- [WaybackSave/Archive] wikipedia .box top level domain – Google Suche
--jeroen






Leave a comment