2

I'm trying to set my hostname for my mac. Currently it's unknown002374e31ebd.

I've tried setting it with

sudo hostname -s Steve-Mac

Which will work for all future terminal sessions. However, if I restart, it goes back to unknown

How can I get it to keep this setting?

4

Setting the hostname via the Terminal is not permanent.

From the hostname manpage:

DESCRIPTION
The hostname utility prints the name of the current host. The super-user can set the hostname by supplying an argument. To keep the hostname between reboots, run `scutil --set HostName name-of-host'.

Alternatively, set the hostname in your System Preferences, under the Sharing section.

  • 1
    Additionally, -s does not stand for "set". Also from the manpage: -s Trim off any domain information from the printed name. – Jason Salaz May 2 '13 at 9:14
  • in my version of scutil, -s doesn't stand for anything, I get the following error when I try to run scutil -s HostName Foobar: scutil: invalid option -- s – Alexej Magura Jan 15 '14 at 14:10
  • I was talking about hostname -s not meaning what OP thought it meant. Indeed, scutil doesn't have a -s option. – Jason Salaz Jan 16 '14 at 22:21
0

Fastest way is to setup it in System Preferences -> Sharing (unlock screen by clicking padlock on bottom) and then change name and Apply.

You must log in to answer this question.

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