I have recently been in terminal and somehow I lost my Mac name. It's showing a strange IP followed by some numbers. My computer's name is "my-xxx-macbook-pro." When I type hostname I receive:


I have been working in AWS a lot to try to develop some products.

How do I get back to my computer in terminal?

  • 1
    Thanks @Allan for keeping me honest! :) I've retracted the close vote. – Monomeeth Jun 2 '17 at 1:12
  • We seem to have multiple questions that could be duplicates, should probably decide on one best one. – JMY1000 Nov 29 '18 at 17:16

Somewhere, whether it be in a virtual network created in AWS or your company's own network, you are being assigned a hostname through a DHCP server (and possibly in conjunction with a RADIUS server).

Looking at the format of the assigned name, it's too specific (us-west-2.compute.internal), and the IP address and domain both point to internal networks.

You can manually set your hostname with the command:

sudo scutil --set HostName "YourHostName"

However, when you reboot, it will revert back to whatever has been assigned to you. Your best bet is to check with your network manager.

  • Sorry, I am new to this but this is my personal laptop and this is on my home network. There is no network manager. Is there a way to log out and log into my Mac? Is there a way to prevent this from happening? – Marv Freed Jun 2 '17 at 19:50

Not the answer you're looking for? Browse other questions tagged .