Remember to maintain security and privacy. Do not share sensitive information. Procedimento.com.br may make mistakes. Verify important information. Termo de Responsabilidade

How to Change and Display Hostname on macOS

In computing, the hostname is a label assigned to a device connected to a network, used to identify the device in various forms of electronic communication such as the internet or a local network. For macOS users, managing the hostname is crucial for network identification, troubleshooting, and ensuring smooth communication between devices. This article will guide you on how to change and display the hostname on macOS using Terminal commands.

Examples:

  1. Displaying the Current Hostname: To display the current hostname of your macOS device, you can use the hostname command in the Terminal. Open Terminal and type the following command:

    hostname

    This command will return the current hostname of your device.

  2. Changing the Hostname Temporarily: If you need to change the hostname temporarily (until the next reboot), you can use the following command:

    sudo scutil --set HostName new-hostname

    Replace new-hostname with your desired hostname. Note that you will need administrative privileges to execute this command, so you will be prompted to enter your password.

  3. Changing the Hostname Permanently: To change the hostname permanently, you will need to update three different names: the HostName, the LocalHostName, and the ComputerName. Use the following commands:

    sudo scutil --set HostName new-hostname
    sudo scutil --set LocalHostName new-hostname
    sudo scutil --set ComputerName new-hostname

    Again, replace new-hostname with your desired hostname. These commands ensure that the hostname is consistent across reboots and network interfaces.

  4. Verifying the Changes: After changing the hostname, you can verify the changes by running the following commands:

    scutil --get HostName
    scutil --get LocalHostName
    scutil --get ComputerName

    These commands will display the current values of the HostName, LocalHostName, and ComputerName, confirming that your changes have been applied.

To share Download PDF

Gostou do artigo? Deixe sua avaliação!
Sua opinião é muito importante para nós. Clique em um dos botões abaixo para nos dizer o que achou deste conteúdo.