2

When following various guides on using scutil the following would seem to be correct for setting the hostname:

$sudo scutil –-set HostName doriath
>

But as you can see instead of setting the hostname a prompt > is shown: and the hostname is not set. What is wrong here? I am on El Capitan.

2 Answers 2

4

The prompt is the interactive mode of scutil which usually is invoked by the single command scutil without options. To quit the interactive mode enter quit at the prompt.

In your case you are simply using the wrong dash: probably the en-dash (UTF-8: U+2013 - e2 80 93) and a normal dash and your whole command is interpreted as scutil only.

Instead of sudo scutil –-set HostName doriath use sudo scutil --set HostName doriath!

1
  • ya - looks like I missed replacing one of the two dashes from the cut and paste. Commented Dec 3, 2016 at 5:30
2

Try these additional commands to get your system renamed AND put double quotes around the name in each instance:

sudo scutil --set ComputerName "doriath"

sudo scutil --set HostName "doriath"

sudo scutil --set LocalHostName "doriath"

This has worked for me several times. Hope it does for you too.

3
  • Thx I had tried with quotes already as well and same result as OP Commented Dec 3, 2016 at 0:30
  • The behavior in my case is strange . I can't understand the failure mode to end up in some kind of completion shell. Commented Dec 3, 2016 at 0:31
  • Try using the su [your username] command string before the other 3 commands.
    – KarlC
    Commented Dec 3, 2016 at 0:42

You must log in to answer this question.

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