macOS Sierra (10.12.6) hostname command not appending “.local”












1















To be brief:



From what I understand the hostname command has an option -f. From the man page:




-f Include 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 MY-COMPUTER-NAME.



Some additional information:



I'm unable to change the "Computer Name" in the "Sharing" preferences (it's grayed out as pictured here):



sharing preferences showing computer name set to Hippotigris and a message that says: "Computers on your local network can access your computer at: LM-SJN-21001464



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 hostname command:



sharing preferences with an input field for Local Hostname set to LM-SJN-21001464 ending in ".local" grayed out



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.










share|improve this question


















  • 2





    Do a Google search for "local mDNS" and have a look at en.wikipedia.org/wiki/.local In short, .local is a bit special, but I don't know if it is this that creates issues for you or not.

    – Kusalananda
    Aug 4 '18 at 6:30
















1















To be brief:



From what I understand the hostname command has an option -f. From the man page:




-f Include 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 MY-COMPUTER-NAME.



Some additional information:



I'm unable to change the "Computer Name" in the "Sharing" preferences (it's grayed out as pictured here):



sharing preferences showing computer name set to Hippotigris and a message that says: "Computers on your local network can access your computer at: LM-SJN-21001464



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 hostname command:



sharing preferences with an input field for Local Hostname set to LM-SJN-21001464 ending in ".local" grayed out



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.










share|improve this question


















  • 2





    Do a Google search for "local mDNS" and have a look at en.wikipedia.org/wiki/.local In short, .local is a bit special, but I don't know if it is this that creates issues for you or not.

    – Kusalananda
    Aug 4 '18 at 6:30














1












1








1








To be brief:



From what I understand the hostname command has an option -f. From the man page:




-f Include 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 MY-COMPUTER-NAME.



Some additional information:



I'm unable to change the "Computer Name" in the "Sharing" preferences (it's grayed out as pictured here):



sharing preferences showing computer name set to Hippotigris and a message that says: "Computers on your local network can access your computer at: LM-SJN-21001464



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 hostname command:



sharing preferences with an input field for Local Hostname set to LM-SJN-21001464 ending in ".local" grayed out



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.










share|improve this question














To be brief:



From what I understand the hostname command has an option -f. From the man page:




-f Include 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 MY-COMPUTER-NAME.



Some additional information:



I'm unable to change the "Computer Name" in the "Sharing" preferences (it's grayed out as pictured here):



sharing preferences showing computer name set to Hippotigris and a message that says: "Computers on your local network can access your computer at: LM-SJN-21001464



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 hostname command:



sharing preferences with an input field for Local Hostname set to LM-SJN-21001464 ending in ".local" grayed out



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.







osx dns hostname






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Aug 4 '18 at 4:47









kentcdoddskentcdodds

1265




1265








  • 2





    Do a Google search for "local mDNS" and have a look at en.wikipedia.org/wiki/.local In short, .local is a bit special, but I don't know if it is this that creates issues for you or not.

    – Kusalananda
    Aug 4 '18 at 6:30














  • 2





    Do a Google search for "local mDNS" and have a look at en.wikipedia.org/wiki/.local In short, .local is a bit special, but I don't know if it is this that creates issues for you or not.

    – Kusalananda
    Aug 4 '18 at 6:30








2




2





Do a Google search for "local mDNS" and have a look at en.wikipedia.org/wiki/.local In short, .local is a bit special, but I don't know if it is this that creates issues for you or not.

– Kusalananda
Aug 4 '18 at 6:30





Do a Google search for "local mDNS" and have a look at en.wikipedia.org/wiki/.local In short, .local is a bit special, but I don't know if it is this that creates issues for you or not.

– Kusalananda
Aug 4 '18 at 6:30










3 Answers
3






active

oldest

votes


















2














Thanks to some help on twitter I added ".local" to my search domains in my DNS settings and that fixed my core problem, though hostname (and os.hostname) still return a hostname without the ".local" appended.



So this is an answer to the problem I was having, but not the question I posted and I would still love to understand what's going on and whether I should be concerned.



network preferences in the DNS tab showing "Search Domains" includes ".local"






share|improve this answer































    1














    The hostname is the name of the machine itself. The part that comes after the hostname, i.e. .local in hippotigris.local or .kentcdodds.com in hippotrigris.kentcdodds.com is the so-called domain name.



    You never should add the domain name to the hostname itself.



    As already mentioned in the comments, .local is special: It's the domain for mDNS, which does multicast name resolution in your local LAN segment. This works differently for normal DNS name resolution, and is extensively used by Apple.



    So when you do require('dns').lookup() in node, it will lookup using the normal DNS mechanism. However, your hostname isn't registered in whatever you use as the normal DNS server (either the one on your home router, or your ISP's DNS server). Therefore you don't get an answer.



    If you append .local, node (or the underlying MacOS libraries) use mDNS instead, which means they can find your hostname.



    So that's why you need to append .local in some place, either directly, or automatically in the search path, or by whatever other means (e.g. on Linux, you can configure name search to use both DNS and mDNS, in any order).



    As for why the hostname you enter in the GUI window you've shown (Hippotigrisis) is different from the name that's announced via mDNS (LM-SJN-21001464), I am not sure (because the Mac UI gives no hint of what is actually going on) - one would have to find out what information this dialog sets, exactly, and where the other name (which looks like a serial number) is set. Command line tools may help in searching for this.






    share|improve this answer































      0














      Wow, this is a bit a doozy ...of a question, as there are a couple of things going on here.




      Trying not to repeat what others have said




      ...I'm going to assume you are wanting to access your mDNS name of a Node app you are working with, so you can view the app from a separate box on your LAN, and would prefer to use the mDNS without having to use .local in the address name as opposed to using the IPv4 address, which by the way, tools such as webpack allow setting a 0.0.0.0 hostname in a webpack configuration file to access a dev server build of app on a LAN, ie. access a locally running React app running on your MacBook from a separate mobile device.



      Doing a couple AOL keyword searches it seems that the name you are referring to in the sharing pane of the system prefs on macOS can also be a NETBIOS name, and apparently at some point a NETBIOS name can't be longer than 15 chars not sure if this is still the case, hence why your computer name with the LM... is exactly 15 chars when I counted it.



      Taking a shot in the dark here 🐦📦, as you didn't describe the devices on your the network in question, ie. is there a domain controller? or is this a home network? work network? or somehow a network that you connect to, and there is a device that is dynamically changing the hostname of your computer when it finishes connecting to that network?



      All that said, I to am running macOS, ie. 10.13.x at the moment, and when I run,



      hostname -f


      it returns my



      $HOSTNAME.local


      ie



      rogue.local


      On my home network, I have a router connected to a modem, and that router does not do any domain name type configuration as far as I can tell, I believe the default workgroup name is WORKGROUP.



      ...ahhh typing out load here, going into Sys Prefs > Network tab > WINS ...look for NetBIOS name, and see what that is set to, you might want to see if that name is changing when you connect to different networks. Finally, if I understand your question correctly you are trying to access your computer from an external device using the hostname of the computer rather than using the IPv4 address, and as others have already said, accessing hostnames on LAN using mDNS relies on that little .local bit to perform its magic 🧙‍♀️. That said, if it was me, I'd keep the .local as a part of what you are working with as it will let others know their accessing your Node app via mDNS.



      wins-name






      share|improve this answer























        Your Answer








        StackExchange.ready(function() {
        var channelOptions = {
        tags: "".split(" "),
        id: "106"
        };
        initTagRenderer("".split(" "), "".split(" "), channelOptions);

        StackExchange.using("externalEditor", function() {
        // Have to fire editor after snippets, if snippets enabled
        if (StackExchange.settings.snippets.snippetsEnabled) {
        StackExchange.using("snippets", function() {
        createEditor();
        });
        }
        else {
        createEditor();
        }
        });

        function createEditor() {
        StackExchange.prepareEditor({
        heartbeatType: 'answer',
        autoActivateHeartbeat: false,
        convertImagesToLinks: false,
        noModals: true,
        showLowRepImageUploadWarning: true,
        reputationToPostImages: null,
        bindNavPrevention: true,
        postfix: "",
        imageUploader: {
        brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
        contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
        allowUrls: true
        },
        onDemand: true,
        discardSelector: ".discard-answer"
        ,immediatelyShowMarkdownHelp:true
        });


        }
        });














        draft saved

        draft discarded


















        StackExchange.ready(
        function () {
        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f460460%2fmacos-sierra-10-12-6-hostname-command-not-appending-local%23new-answer', 'question_page');
        }
        );

        Post as a guest















        Required, but never shown

























        3 Answers
        3






        active

        oldest

        votes








        3 Answers
        3






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes









        2














        Thanks to some help on twitter I added ".local" to my search domains in my DNS settings and that fixed my core problem, though hostname (and os.hostname) still return a hostname without the ".local" appended.



        So this is an answer to the problem I was having, but not the question I posted and I would still love to understand what's going on and whether I should be concerned.



        network preferences in the DNS tab showing "Search Domains" includes ".local"






        share|improve this answer




























          2














          Thanks to some help on twitter I added ".local" to my search domains in my DNS settings and that fixed my core problem, though hostname (and os.hostname) still return a hostname without the ".local" appended.



          So this is an answer to the problem I was having, but not the question I posted and I would still love to understand what's going on and whether I should be concerned.



          network preferences in the DNS tab showing "Search Domains" includes ".local"






          share|improve this answer


























            2












            2








            2







            Thanks to some help on twitter I added ".local" to my search domains in my DNS settings and that fixed my core problem, though hostname (and os.hostname) still return a hostname without the ".local" appended.



            So this is an answer to the problem I was having, but not the question I posted and I would still love to understand what's going on and whether I should be concerned.



            network preferences in the DNS tab showing "Search Domains" includes ".local"






            share|improve this answer













            Thanks to some help on twitter I added ".local" to my search domains in my DNS settings and that fixed my core problem, though hostname (and os.hostname) still return a hostname without the ".local" appended.



            So this is an answer to the problem I was having, but not the question I posted and I would still love to understand what's going on and whether I should be concerned.



            network preferences in the DNS tab showing "Search Domains" includes ".local"







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Aug 4 '18 at 4:58









            kentcdoddskentcdodds

            1265




            1265

























                1














                The hostname is the name of the machine itself. The part that comes after the hostname, i.e. .local in hippotigris.local or .kentcdodds.com in hippotrigris.kentcdodds.com is the so-called domain name.



                You never should add the domain name to the hostname itself.



                As already mentioned in the comments, .local is special: It's the domain for mDNS, which does multicast name resolution in your local LAN segment. This works differently for normal DNS name resolution, and is extensively used by Apple.



                So when you do require('dns').lookup() in node, it will lookup using the normal DNS mechanism. However, your hostname isn't registered in whatever you use as the normal DNS server (either the one on your home router, or your ISP's DNS server). Therefore you don't get an answer.



                If you append .local, node (or the underlying MacOS libraries) use mDNS instead, which means they can find your hostname.



                So that's why you need to append .local in some place, either directly, or automatically in the search path, or by whatever other means (e.g. on Linux, you can configure name search to use both DNS and mDNS, in any order).



                As for why the hostname you enter in the GUI window you've shown (Hippotigrisis) is different from the name that's announced via mDNS (LM-SJN-21001464), I am not sure (because the Mac UI gives no hint of what is actually going on) - one would have to find out what information this dialog sets, exactly, and where the other name (which looks like a serial number) is set. Command line tools may help in searching for this.






                share|improve this answer




























                  1














                  The hostname is the name of the machine itself. The part that comes after the hostname, i.e. .local in hippotigris.local or .kentcdodds.com in hippotrigris.kentcdodds.com is the so-called domain name.



                  You never should add the domain name to the hostname itself.



                  As already mentioned in the comments, .local is special: It's the domain for mDNS, which does multicast name resolution in your local LAN segment. This works differently for normal DNS name resolution, and is extensively used by Apple.



                  So when you do require('dns').lookup() in node, it will lookup using the normal DNS mechanism. However, your hostname isn't registered in whatever you use as the normal DNS server (either the one on your home router, or your ISP's DNS server). Therefore you don't get an answer.



                  If you append .local, node (or the underlying MacOS libraries) use mDNS instead, which means they can find your hostname.



                  So that's why you need to append .local in some place, either directly, or automatically in the search path, or by whatever other means (e.g. on Linux, you can configure name search to use both DNS and mDNS, in any order).



                  As for why the hostname you enter in the GUI window you've shown (Hippotigrisis) is different from the name that's announced via mDNS (LM-SJN-21001464), I am not sure (because the Mac UI gives no hint of what is actually going on) - one would have to find out what information this dialog sets, exactly, and where the other name (which looks like a serial number) is set. Command line tools may help in searching for this.






                  share|improve this answer


























                    1












                    1








                    1







                    The hostname is the name of the machine itself. The part that comes after the hostname, i.e. .local in hippotigris.local or .kentcdodds.com in hippotrigris.kentcdodds.com is the so-called domain name.



                    You never should add the domain name to the hostname itself.



                    As already mentioned in the comments, .local is special: It's the domain for mDNS, which does multicast name resolution in your local LAN segment. This works differently for normal DNS name resolution, and is extensively used by Apple.



                    So when you do require('dns').lookup() in node, it will lookup using the normal DNS mechanism. However, your hostname isn't registered in whatever you use as the normal DNS server (either the one on your home router, or your ISP's DNS server). Therefore you don't get an answer.



                    If you append .local, node (or the underlying MacOS libraries) use mDNS instead, which means they can find your hostname.



                    So that's why you need to append .local in some place, either directly, or automatically in the search path, or by whatever other means (e.g. on Linux, you can configure name search to use both DNS and mDNS, in any order).



                    As for why the hostname you enter in the GUI window you've shown (Hippotigrisis) is different from the name that's announced via mDNS (LM-SJN-21001464), I am not sure (because the Mac UI gives no hint of what is actually going on) - one would have to find out what information this dialog sets, exactly, and where the other name (which looks like a serial number) is set. Command line tools may help in searching for this.






                    share|improve this answer













                    The hostname is the name of the machine itself. The part that comes after the hostname, i.e. .local in hippotigris.local or .kentcdodds.com in hippotrigris.kentcdodds.com is the so-called domain name.



                    You never should add the domain name to the hostname itself.



                    As already mentioned in the comments, .local is special: It's the domain for mDNS, which does multicast name resolution in your local LAN segment. This works differently for normal DNS name resolution, and is extensively used by Apple.



                    So when you do require('dns').lookup() in node, it will lookup using the normal DNS mechanism. However, your hostname isn't registered in whatever you use as the normal DNS server (either the one on your home router, or your ISP's DNS server). Therefore you don't get an answer.



                    If you append .local, node (or the underlying MacOS libraries) use mDNS instead, which means they can find your hostname.



                    So that's why you need to append .local in some place, either directly, or automatically in the search path, or by whatever other means (e.g. on Linux, you can configure name search to use both DNS and mDNS, in any order).



                    As for why the hostname you enter in the GUI window you've shown (Hippotigrisis) is different from the name that's announced via mDNS (LM-SJN-21001464), I am not sure (because the Mac UI gives no hint of what is actually going on) - one would have to find out what information this dialog sets, exactly, and where the other name (which looks like a serial number) is set. Command line tools may help in searching for this.







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Aug 4 '18 at 20:05









                    dirktdirkt

                    16.9k21336




                    16.9k21336























                        0














                        Wow, this is a bit a doozy ...of a question, as there are a couple of things going on here.




                        Trying not to repeat what others have said




                        ...I'm going to assume you are wanting to access your mDNS name of a Node app you are working with, so you can view the app from a separate box on your LAN, and would prefer to use the mDNS without having to use .local in the address name as opposed to using the IPv4 address, which by the way, tools such as webpack allow setting a 0.0.0.0 hostname in a webpack configuration file to access a dev server build of app on a LAN, ie. access a locally running React app running on your MacBook from a separate mobile device.



                        Doing a couple AOL keyword searches it seems that the name you are referring to in the sharing pane of the system prefs on macOS can also be a NETBIOS name, and apparently at some point a NETBIOS name can't be longer than 15 chars not sure if this is still the case, hence why your computer name with the LM... is exactly 15 chars when I counted it.



                        Taking a shot in the dark here 🐦📦, as you didn't describe the devices on your the network in question, ie. is there a domain controller? or is this a home network? work network? or somehow a network that you connect to, and there is a device that is dynamically changing the hostname of your computer when it finishes connecting to that network?



                        All that said, I to am running macOS, ie. 10.13.x at the moment, and when I run,



                        hostname -f


                        it returns my



                        $HOSTNAME.local


                        ie



                        rogue.local


                        On my home network, I have a router connected to a modem, and that router does not do any domain name type configuration as far as I can tell, I believe the default workgroup name is WORKGROUP.



                        ...ahhh typing out load here, going into Sys Prefs > Network tab > WINS ...look for NetBIOS name, and see what that is set to, you might want to see if that name is changing when you connect to different networks. Finally, if I understand your question correctly you are trying to access your computer from an external device using the hostname of the computer rather than using the IPv4 address, and as others have already said, accessing hostnames on LAN using mDNS relies on that little .local bit to perform its magic 🧙‍♀️. That said, if it was me, I'd keep the .local as a part of what you are working with as it will let others know their accessing your Node app via mDNS.



                        wins-name






                        share|improve this answer




























                          0














                          Wow, this is a bit a doozy ...of a question, as there are a couple of things going on here.




                          Trying not to repeat what others have said




                          ...I'm going to assume you are wanting to access your mDNS name of a Node app you are working with, so you can view the app from a separate box on your LAN, and would prefer to use the mDNS without having to use .local in the address name as opposed to using the IPv4 address, which by the way, tools such as webpack allow setting a 0.0.0.0 hostname in a webpack configuration file to access a dev server build of app on a LAN, ie. access a locally running React app running on your MacBook from a separate mobile device.



                          Doing a couple AOL keyword searches it seems that the name you are referring to in the sharing pane of the system prefs on macOS can also be a NETBIOS name, and apparently at some point a NETBIOS name can't be longer than 15 chars not sure if this is still the case, hence why your computer name with the LM... is exactly 15 chars when I counted it.



                          Taking a shot in the dark here 🐦📦, as you didn't describe the devices on your the network in question, ie. is there a domain controller? or is this a home network? work network? or somehow a network that you connect to, and there is a device that is dynamically changing the hostname of your computer when it finishes connecting to that network?



                          All that said, I to am running macOS, ie. 10.13.x at the moment, and when I run,



                          hostname -f


                          it returns my



                          $HOSTNAME.local


                          ie



                          rogue.local


                          On my home network, I have a router connected to a modem, and that router does not do any domain name type configuration as far as I can tell, I believe the default workgroup name is WORKGROUP.



                          ...ahhh typing out load here, going into Sys Prefs > Network tab > WINS ...look for NetBIOS name, and see what that is set to, you might want to see if that name is changing when you connect to different networks. Finally, if I understand your question correctly you are trying to access your computer from an external device using the hostname of the computer rather than using the IPv4 address, and as others have already said, accessing hostnames on LAN using mDNS relies on that little .local bit to perform its magic 🧙‍♀️. That said, if it was me, I'd keep the .local as a part of what you are working with as it will let others know their accessing your Node app via mDNS.



                          wins-name






                          share|improve this answer


























                            0












                            0








                            0







                            Wow, this is a bit a doozy ...of a question, as there are a couple of things going on here.




                            Trying not to repeat what others have said




                            ...I'm going to assume you are wanting to access your mDNS name of a Node app you are working with, so you can view the app from a separate box on your LAN, and would prefer to use the mDNS without having to use .local in the address name as opposed to using the IPv4 address, which by the way, tools such as webpack allow setting a 0.0.0.0 hostname in a webpack configuration file to access a dev server build of app on a LAN, ie. access a locally running React app running on your MacBook from a separate mobile device.



                            Doing a couple AOL keyword searches it seems that the name you are referring to in the sharing pane of the system prefs on macOS can also be a NETBIOS name, and apparently at some point a NETBIOS name can't be longer than 15 chars not sure if this is still the case, hence why your computer name with the LM... is exactly 15 chars when I counted it.



                            Taking a shot in the dark here 🐦📦, as you didn't describe the devices on your the network in question, ie. is there a domain controller? or is this a home network? work network? or somehow a network that you connect to, and there is a device that is dynamically changing the hostname of your computer when it finishes connecting to that network?



                            All that said, I to am running macOS, ie. 10.13.x at the moment, and when I run,



                            hostname -f


                            it returns my



                            $HOSTNAME.local


                            ie



                            rogue.local


                            On my home network, I have a router connected to a modem, and that router does not do any domain name type configuration as far as I can tell, I believe the default workgroup name is WORKGROUP.



                            ...ahhh typing out load here, going into Sys Prefs > Network tab > WINS ...look for NetBIOS name, and see what that is set to, you might want to see if that name is changing when you connect to different networks. Finally, if I understand your question correctly you are trying to access your computer from an external device using the hostname of the computer rather than using the IPv4 address, and as others have already said, accessing hostnames on LAN using mDNS relies on that little .local bit to perform its magic 🧙‍♀️. That said, if it was me, I'd keep the .local as a part of what you are working with as it will let others know their accessing your Node app via mDNS.



                            wins-name






                            share|improve this answer













                            Wow, this is a bit a doozy ...of a question, as there are a couple of things going on here.




                            Trying not to repeat what others have said




                            ...I'm going to assume you are wanting to access your mDNS name of a Node app you are working with, so you can view the app from a separate box on your LAN, and would prefer to use the mDNS without having to use .local in the address name as opposed to using the IPv4 address, which by the way, tools such as webpack allow setting a 0.0.0.0 hostname in a webpack configuration file to access a dev server build of app on a LAN, ie. access a locally running React app running on your MacBook from a separate mobile device.



                            Doing a couple AOL keyword searches it seems that the name you are referring to in the sharing pane of the system prefs on macOS can also be a NETBIOS name, and apparently at some point a NETBIOS name can't be longer than 15 chars not sure if this is still the case, hence why your computer name with the LM... is exactly 15 chars when I counted it.



                            Taking a shot in the dark here 🐦📦, as you didn't describe the devices on your the network in question, ie. is there a domain controller? or is this a home network? work network? or somehow a network that you connect to, and there is a device that is dynamically changing the hostname of your computer when it finishes connecting to that network?



                            All that said, I to am running macOS, ie. 10.13.x at the moment, and when I run,



                            hostname -f


                            it returns my



                            $HOSTNAME.local


                            ie



                            rogue.local


                            On my home network, I have a router connected to a modem, and that router does not do any domain name type configuration as far as I can tell, I believe the default workgroup name is WORKGROUP.



                            ...ahhh typing out load here, going into Sys Prefs > Network tab > WINS ...look for NetBIOS name, and see what that is set to, you might want to see if that name is changing when you connect to different networks. Finally, if I understand your question correctly you are trying to access your computer from an external device using the hostname of the computer rather than using the IPv4 address, and as others have already said, accessing hostnames on LAN using mDNS relies on that little .local bit to perform its magic 🧙‍♀️. That said, if it was me, I'd keep the .local as a part of what you are working with as it will let others know their accessing your Node app via mDNS.



                            wins-name







                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Jan 21 at 18:21









                            ipatchipatch

                            1115




                            1115






























                                draft saved

                                draft discarded




















































                                Thanks for contributing an answer to Unix & Linux Stack Exchange!


                                • Please be sure to answer the question. Provide details and share your research!

                                But avoid



                                • Asking for help, clarification, or responding to other answers.

                                • Making statements based on opinion; back them up with references or personal experience.


                                To learn more, see our tips on writing great answers.




                                draft saved


                                draft discarded














                                StackExchange.ready(
                                function () {
                                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f460460%2fmacos-sierra-10-12-6-hostname-command-not-appending-local%23new-answer', 'question_page');
                                }
                                );

                                Post as a guest















                                Required, but never shown





















































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown

































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown







                                Popular posts from this blog

                                How to make a Squid Proxy server?

                                Is this a new Fibonacci Identity?

                                19世紀