How to fix MacBook with Android hostname in terminal?

I use the terminal quite often, for some reason the sudden terminal shows the strange hostname android-1e1c8882e08308f9 (see image) at the invitation.

I checked the name of my MacBook in the sharing settings and that is correct, but Terminal still shows the android hostname.

Can anyone advise?

thanks

Terminal screenshots

+7
bash terminal macos
source share
1 answer

By default, the host name of your computer is not set. The Sharing panel allows you to specify a computer name that is an attribute of Mac OS X. My theory is that if the host name is not set, hostname (and your shell prompt) will use this value instead. Below is the output of scutil and hostname on my laptop.

 patikoija ~ % scutil --get ComputerName patikoija patikoija ~ % scutil --get LocalHostName patikoija patikoija ~ % scutil --get HostName HostName: not set patikoija ~ % hostname patikoija.local 

When I am in my company’s office, my hostname is also set to what begins with β€œdhcp-”. I assume that the DHCP server sets the actual host name, and when scutil starts, that name will be displayed. You can try using scutil to set the true hostname of your computer and see if this supports "resistance" to the DHCP server to override it.

+7
source share

All Articles