Changing hostname mac os

linux-notes.org

Имя хоста — это символическое имя, присвоенное сетевому устройству, которое может быть использовано для организации доступа к этому устройству различными способами. Такое имя присваивается каждому устройству, выходящему в сеть. То есть сетевое имя можно определить не только у персонального компьютера, но и у ноутбука, планшета, смартфона, кпк и даже холодильника, если он подключен к интернету. По имени хоста можно предположительно определить ваш регион и интернет оператора. Если у вас динамический ip адрес, то и имя компьютера будет меняться при каждом новом интернет соединении.

Изменить hostname/ComputerName/LocalHostName в Mac OS X

Для начала (если кто-то не знает свой hostname), выполним следующую команду для того, чтобы узнать hostname:

Как видно с вывода, у меня — Macbook, но я могу изменить на любой другой с помощью команды:

Можно более детально ознакомиться с этой командой прочитав man:

Так же, поддерживается синтаксис как и в Unix/Linux и можно выполнить следующую команду:

Она тоже сменит ваш хостнейм.

Можно изменить имя компьютера:

Так же, с легкостью, можно изменить локальный хостнейм:

Очистите DNS кэш:

На этом, я завершаю свою статью «Изменить hostname/ComputerName/LocalHostName в Mac OS X».

Добавить комментарий Отменить ответ

Этот сайт использует Akismet для борьбы со спамом. Узнайте, как обрабатываются ваши данные комментариев.

Источник

Change your computer’s name or local hostname on Mac

Your computer’s name and local hostname are used to identify your computer on your local network.

Change your computer’s name

Your computer’s name is displayed at the top of the Sharing preferences pane.

On your Mac, choose Apple menu

> System Preferences, then click Sharing.

If the lock at the bottom left is locked , click it to unlock the preference pane.

Читайте также:  Windows 10 разряд батареи

Type a new name in the Computer Name field.

Change your computer’s local hostname

The local hostname, or local network name, is displayed beneath the computer’s name at the top of the Sharing preferences pane. It identifies your Mac to Bonjour-compatible services.

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 Preferences, then click Sharing.

If the lock at the bottom left is locked , click it to unlock the preference pane.

Click Edit, then enter a new local hostname.

If your Mac has the exact name of another Mac on your local network, a number is added to the local network name.

Источник

Change your computer’s name or local hostname on Mac

Your computer’s name and local hostname are used to identify your computer on your local network.

Change your computer’s name

Your computer’s name is displayed at the top of the Sharing preferences pane.

On your Mac, choose Apple menu

> System Preferences, then click Sharing.

If the lock at the bottom left is locked , click it to unlock the preference pane.

Type a new name in the Computer Name field.

Change your computer’s local hostname

The local hostname or local network name, is displayed beneath the computer’s name at the top of the Sharing preferences pane. It identifies your Mac to Bonjour-compatible services.

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 Preferences, then click Sharing.

If the lock at the bottom left is locked , click it to unlock the preference pane.

Click Edit, then enter a new local hostname.

If your Mac has the exact name of another Mac on your local network, a number is added to the local network name.

Источник

Change your Mac Hostname via Terminal

Need to change the hostname of a Mac? For most people if you want to change your Mac computer name you just do it through the Sharing system preference, it’s quick and very easy. For those of us that are more geekishly inclined, we like to do things through the Terminal.

Читайте также:  Как узнать домашнюю папку пользователя linux

This tutorial will show how to change your Mac hostname with the command line and make the setting change permanent (well, permanent until you change it again):

How to Change Host Name on Mac from the Command Line

To get started, launch the Terminal application in Mac OS and then use the following command syntax:

sudo scutil –-set HostName new_hostname

Simply replace new_hostname with whatever you want your hostname to be changed to, for example I want to change a Mac’s hostname to MacBookPro, I will use this command:

sudo scutil –-set HostName MacBookPro

(Note the “–” before set is two dashes next to each other, –set)

You will be asked for your admin password since you’re using the sudo command.

Another Method for Setting the Mac Hostname

With modern MacOS releases from Mac OS X Mavericks and newer, you can also use the hostname command with a flag to set the hostname to be permanently changed:

sudo hostname -s YourHostName

Again, sudo requires admin privileges to complete the job.

Checking the Current Mac Hostname from the Command Line

After the above command is executed you can verify that the changes took place by typing:

If you want to watch this done, the short video below walks through the steps by using scutil:

Setting a Temporary Hostname Change

You can also set a temporary hostname change by using the following command:

sudo hostname new_hostname

This particular approach is temporary and will reset itself after your Mac reboots though, so if you want a permanent hostname change, use the above command instead. You can still use the hostname command but it will require the -s flag as discussed in the aforementioned instructions. Thank you to commenter Jim for pointing this out!

That’s all there is to it. By default Mac OS X will usually assign the hostname as whatever the admin account username is. Changing your Mac’s hostname can make it easier to find your Mac on a network and to connect to.

Источник

How to change computer name so terminal displays it in Mac OS X Mountain Lion? [duplicate]

When I setup my computer I named it «Scott’s MacBook Pro». And so when I go to System preferences->Sharing, it says Scott’s MacBook Pro there as my computer name. However, opening up a terminal gives me this prompt:

Читайте также:  Hiwatch mac os plugin

When I login to Backblaze, they list my computer as «new‑host‑4_2012_10_07». Did I not fully set my computer name? Should I use the traditional hostname command?

8 Answers 8

it will work a bit better. From the scutil(8) man page:

I would add these last two steps.

  • Flush the DNS cache by typing: dscacheutil -flushcache
  • Restart your Mac.

EDIT: It didn’t work for me until I restarted my mac.

For those who are not looking for a command line solution, you can change it under

You can define what you want to see before the $ in your terminal by modifying the file

For example if you add to the file

/.profile the following line:

you will see the host name and the complete path of the current directory:

You can also modify my example by using the following options in the export command:

in Terminal to change the name.

In my case, I found that it was a problem with our DNS server, as the reverse DNS lookup didn’t scavenge because there was duplicate DNS entries for the IP address and hostname.

I didn’t do anything to my computer, but eventually for some reason the hostname and computer name all registered as the name I initially set! In fact I had the following terminal open the whole time and this is exactly a cut and paste:

I am adding an answer here because I have recently run into this problem as well.

In OSX 10.7.4 and possibly prior, there appears to be a bug in the Edit Hostname option in the Sharing preference panel. It sets the hostname to the last thing set instead of the current this set.

I had to run sudo hostname [preferred hostname] in order to set it correctly, after setting it in Sharing.

Not the answer you’re looking for? Browse other questions tagged macos sharing rename hosts .

Linked

Hot Network Questions

site design / logo © 2021 Stack Exchange Inc; user contributions licensed under cc by-sa. rev 2021.10.8.40416

By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.

Источник

Оцените статью