Categories: Command-Line

Chris Manning

Share
Open the Terminal (located in /Applications/Utilities), or SSH into the Mac that you will be changing this setting on. Type the following command, replacing “name” with the name you want for your Mac and press enter:
Copy to Clipboard
Type the following command, replacing “name” with the name that you want for your local network to Bonjour-based services:
Copy to Clipboard
Set how the computer is displayed when connecting through SSH, and inside Terminal by typing the following command, replacing “name” with the name you want to use to display in the Terminal and when connecting to the machine over SSH:
Copy to Clipboard

Note: When specifying a LocalHostName and HostName, you should not have spaces in the name. After you press return for each of the items above, you will be prompted to enter your administrator password to authenticate the changes.

Now, you can use these commands in Terminal to ensure that the proper items were set, using HostName, LocalHostName or ComputerName. Enter each of these separately:
Copy to Clipboard
Copy to Clipboard
Copy to Clipboard
You can flush the DNS cache with the following but this is not necessary:
Copy to Clipboard

Note: By default, there is no “Host Name” set on a Mac.

Leave A Comment

Related Posts

  • Category: General

    A client had been maintaining their own WordPress website and decided to update the Elementor Pro plugin. Now, the site had not been touched [...]

    Read More
  • Category: Apple, Google, iOS

    If you have logged into Google maps on your iPhone and you're wondering how you can log out of your account. Follow the steps [...]

    Read More
  • Just upgraded your version of Parallels Desktop for Mac and discovered the caps lock stays on. Are you now unable to log into your [...]

    Read More