-1

Is there an equivalent on MacOS to the Linux hostnamectl command?

2
  • 3
    apple.stackexchange.com/questions/287760/… maybe? Commented Jun 17 at 21:41
  • Nitpick: hostnamectl is not a Linux command. It is a SystemD-HostnameD command. There are many Linux distributions which do not use SystemD, and thus do not have hostnamectl. And while I don't know of the existence of such a system, it would theoretically be possible to implement the Freedesktop specification and SystemD on a non-Linux system. Commented Jun 19 at 13:27

1 Answer 1

2

Yes, it's scutil.

From the documentation:

scutil Manage system configuration parameters. (...) --get <pref> Retrieves the specified preference. The current value will be reported on standard output. Supported preferences include: ComputerName The user-friendly name for the system. LocalHostName The local (Bonjour) host name. HostName The name associated with hostname(1) and gethostname(3). --set <pref> [newval] Updates the specified preference with the new value. If the new value is not specified on the command line then it will be read from standard input. Supported preferences include: ComputerName LocalHostName HostName The --set option requires super-user access. 

Related question on Apple SE: https://apple.stackexchange.com/questions/287760/set-the-hostname-computer-name-for-macos (thanks to @MarcusMüller for the comment).

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.