Hostname instellen in Mac OS X

Sinds een tijdje was de hostnaam in de terminal van mijn iMac veranderd in de originele hostname met een prefix -2.

Nogal storend, maar wel eenvoudig te fixen…

The scutil command will set the following 3 items:
1) ComputerName (AppleTalk Name, SharingPrefPane, “Computer Name”)
2) LocalHostName (‘DNS’ name, how to get to a computer on a network by hostname, the ‘Edit’ button in Sharing PrefPane)
3) HostName (UNIX hostname, what shows up in terminal.)

For 1 and 2, scutil will make changes to this file: /Library/Preferences/SystemConfiguration/preferences.plist (Root -> System -> System)

SharingPrefPane ALSO makes changes to this .plist

So, if you’re a SysAdmin, like me, you can set ComputerName and LocalHostName by command line using:

sudo scutil --set ComputerName compname
sudo scutil --set LocalHostName compname

Deze info is hier te vinden.