Created
April 12, 2019 21:00
-
-
Save sboorlagadda/150d6700c5a0df6b814d3712ac040d80 to your computer and use it in GitHub Desktop.
Why is my hostname resolution taking so long?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I was able to fix this issue by explicitly setting the HostName using scutil to be the same value as LocalHostName: | |
$ scutil --set HostName $(scutil --get LocalHostName) | |
Now: | |
$ sudo scutil --set HostName MacBook-Pro | |
$ time python -c 'import socket; print(socket.getfqdn())' | |
MacBook-Pro | |
python -c 'import socket; print(socket.getfqdn())' 0.01s user 0.00s system 86% cpu 0.016 total | |
I was confused before because of the following: | |
$ scutil --get LocalHostName | |
MacBook-Pro | |
$ hostname | |
MacBook-Pro.local | |
But: | |
$ scutil --get HostName | |
HostName: not set | |
https://apple.stackexchange.com/questions/175320/why-is-my-hostname-resolution-taking-so-long |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment