Mac Hostname Configuration: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
(Created page with "=Internal= * Mac * https://home.feodorov.com:9443/wiki/Wiki.jsp?page=MacNetworking =Procedure= Become root in a terminal. Then: ==1. Change the Prim...")
 
 
(5 intermediate revisions by the same user not shown)
Line 20: Line 20:
==2. Change the Bonjour Hostname==
==2. Change the Bonjour Hostname==


This is the name usable on the local network (example NOMBP2.local)
This is the name usable on the local network (example NOMBP2 or NOMBP2.local, though in some cases the ".local" prefix causes an "Invalid argument" failure, so don't use it):


<pre>
<pre>
scutil --set LocalHostName NOMBP2.local
scutil --set LocalHostName NOMBP2
</pre>
</pre>


It seems the local name can also be changed as follows:
The local name can also be changed as follows:


System Preferences -> Sharing -> Computer Name -> Edit: NOMBP2 (.local will be added by default).
System Preferences Sharing Computer Name Edit: NOMBP2 (.local will be added by default).


Query:
Query:
Line 44: Line 44:
</pre>
</pre>


It seems the user-friendly name can also be changed as follows:
The user-friendly name can also be changed as follows:


System Preferences -> Sharing -> Computer Name -> Edit in place (do not click Edit, that changes the local name, see [MacConfiguration#2.ChangeTheBonjourHostname])
System Preferences Sharing Computer Name Edit in place (do not click Edit, that changes the local name, see [MacConfiguration#2.ChangeTheBonjourHostname])


Query:
Query:
Line 58: Line 58:
<pre>
<pre>
dnscacheutil -flushcache
dnscacheutil -flushcache
<pre>
</pre>




Restart the computer.
Restart the computer.

Latest revision as of 22:16, 18 July 2021

Internal

Procedure

Become root in a terminal.

Then:

1. Change the Primary Hostname

The primary hostname is the fully qualified hostname (example NOMBP2.novaordis.com)

scutil --set HostName NOMBP2.novaordis.com

2. Change the Bonjour Hostname

This is the name usable on the local network (example NOMBP2 or NOMBP2.local, though in some cases the ".local" prefix causes an "Invalid argument" failure, so don't use it):

scutil --set LocalHostName NOMBP2

The local name can also be changed as follows:

System Preferences → Sharing → Computer Name → Edit: NOMBP2 (.local will be added by default).

Query:

scutil --get LocalHostName

3. Change the Computer Name

This is the user-friendly computer name you see in Finder

scutil --set ComputerName NOMBP2

The user-friendly name can also be changed as follows:

System Preferences → Sharing → Computer Name → Edit in place (do not click Edit, that changes the local name, see [MacConfiguration#2.ChangeTheBonjourHostname])

Query:

scutil --get ComputerName

4. Flush the DNS Cache

dnscacheutil -flushcache


Restart the computer.