To be brief:
From what I understand the
hostname command has an option
-f. From the man page:
-fInclude domain information in the printed name. This is the default behavior.
As it's the default behavior, I was surprised when my printed name did not include domain information, but simply
Some additional information:
I'm unable to change the "Computer Name" in the "Sharing" preferences (it's grayed out as pictured here):
Originally, my "Local Hostname" was set to "Hippotigris" as well, but when I noticed this problem, I changed it to what I was getting from the
I found this article entitled "Setting the Mac hostname or computer name from the terminal" but I'm not certain whether doing that will solve my problem or aggrevate it.
What I'm trying to accomplish:
I'm using NodeJS's built-in
dns.lookup function in combination with it's built-in
os.hostname function. I presume that the
hostname function returns the same thing that the
hostname command prints (which is what it's doing currently). When I run:
node -e "require('dns').lookup(require('os').hostname() + '.local', console.log)"
It works fine and prints the ip address of my machine on the local network, but when I run
node -e "require('dns').lookup(require('os').hostname(), console.log)"
It logs the error:
getaddrinfo ENOTFOUND LM-SJN-21001464
I've asked around and it appears this script without the
.local works for most people, so I'm guessing it has something to do with my machine configuration.