/etc/hosts not working on macOS 10.13OSX Sierra hosts file is ignoredWindows 7 etc/hosts file broken?Why does...

Why is "la Gestapo" feminine?

Exposing a company lying about themselves in a tightly knit industry: Is my career at risk on the long run?

Do people actually use the word "kaputt" in conversation?

What is it called when someone votes for an option that's not their first choice?

Print last inputted byte

What is the tangent at a sharp point on a curve?

Jem'Hadar, something strange about their life expectancy

How do researchers send unsolicited emails asking for feedback on their works?

Why is participating in the European Parliamentary elections used as a threat?

Unfrosted light bulb

Is "inadequate referencing" a euphemism for plagiarism?

Have any astronauts/cosmonauts died in space?

Fair way to split coins

Interior of Set Notation

Air travel with refrigerated insulin

Justification failure in beamer enumerate list

What are the rules for concealing thieves' tools (or items in general)?

Should I be concerned about student access to a test bank?

Why doesn't the fusion process of the sun speed up?

is this saw blade faulty?

When did hardware antialiasing start being available?

Turning a hard to access nut?

Can other pieces capture a threatening piece and prevent a checkmate?

Determine voltage drop over 10G resistors with cheap multimeter



/etc/hosts not working on macOS 10.13


OSX Sierra hosts file is ignoredWindows 7 etc/hosts file broken?Why does editing my hosts file to block websites show them as LISTENING?Simulate manipulation of the etc/hosts file in Google ChromeWhy can't I block Facebook using /etc/hosts on Mountain Lion (OS X)?Hosts file changes are not recognized in Windows 8Hosts file on Mountain Lion stopped working suddenlyHosts file redirect to domainWhy isn't /etc/hosts blocking domains after I add blocked sites via launchd?Unable to redirect a website by modifying etc/hosts fileRedirecting domains in /etc/hosts













1















I tried to use /etc/hosts file to redirect some websites to localhost.
To do so, I opened it in terminal using sudo nano /etc/hosts then I modified the file, and saved it. As the last step I flushed the DNS cache with sudo killall -HUP mDNSResponder.



Here's what my hosts file looks like:



$ cat /etc/hosts
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 somethig.com
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost


This simply doesn't work. I tried to reboot, without luck. I also did a lot of research but did not find any working answers on the internet. Does the OS still use this file, or will this never really work?



I'm using macOS 10.13.










share|improve this question

























  • Does OSX Sierra hosts file is ignored help?

    – Andrew Morton
    Mar 6 '18 at 18:50
















1















I tried to use /etc/hosts file to redirect some websites to localhost.
To do so, I opened it in terminal using sudo nano /etc/hosts then I modified the file, and saved it. As the last step I flushed the DNS cache with sudo killall -HUP mDNSResponder.



Here's what my hosts file looks like:



$ cat /etc/hosts
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 somethig.com
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost


This simply doesn't work. I tried to reboot, without luck. I also did a lot of research but did not find any working answers on the internet. Does the OS still use this file, or will this never really work?



I'm using macOS 10.13.










share|improve this question

























  • Does OSX Sierra hosts file is ignored help?

    – Andrew Morton
    Mar 6 '18 at 18:50














1












1








1


1






I tried to use /etc/hosts file to redirect some websites to localhost.
To do so, I opened it in terminal using sudo nano /etc/hosts then I modified the file, and saved it. As the last step I flushed the DNS cache with sudo killall -HUP mDNSResponder.



Here's what my hosts file looks like:



$ cat /etc/hosts
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 somethig.com
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost


This simply doesn't work. I tried to reboot, without luck. I also did a lot of research but did not find any working answers on the internet. Does the OS still use this file, or will this never really work?



I'm using macOS 10.13.










share|improve this question
















I tried to use /etc/hosts file to redirect some websites to localhost.
To do so, I opened it in terminal using sudo nano /etc/hosts then I modified the file, and saved it. As the last step I flushed the DNS cache with sudo killall -HUP mDNSResponder.



Here's what my hosts file looks like:



$ cat /etc/hosts
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 somethig.com
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost


This simply doesn't work. I tried to reboot, without luck. I also did a lot of research but did not find any working answers on the internet. Does the OS still use this file, or will this never really work?



I'm using macOS 10.13.







macos hosts-file macos-highsierra






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 6 '18 at 18:56









Andrew Morton

2,16121124




2,16121124










asked Mar 6 '18 at 18:42









dnnagydnnagy

10612




10612













  • Does OSX Sierra hosts file is ignored help?

    – Andrew Morton
    Mar 6 '18 at 18:50



















  • Does OSX Sierra hosts file is ignored help?

    – Andrew Morton
    Mar 6 '18 at 18:50

















Does OSX Sierra hosts file is ignored help?

– Andrew Morton
Mar 6 '18 at 18:50





Does OSX Sierra hosts file is ignored help?

– Andrew Morton
Mar 6 '18 at 18:50










4 Answers
4






active

oldest

votes


















1














I had the hosts and IP addresses separated by tabs, switching to just one space between them worked for me:



127.0.0.1 www3.mytestsite.com





share|improve this answer































    0














    Works for me on a 10.13.3 system.



    % grep example /etc/hosts
    127.0.0.1 example.com
    % perl -MSocket -e 'printf "%vxn", inet_aton "example.com"'
    7f.0.0.1
    % dns-sd -G v4 example.com
    DATE: ---Tue 06 Mar 2018---
    10:49:47.455 ...STARTING...
    Timestamp A/R Flags if Hostname Address
    TTL
    10:49:47.457 Add 2 -1 example.com. 127.0.0.1
    1
    ^C


    However! Some applications (e.g. Google Chrome) may make their own queries to their own DNS servers (e.g. to 8.8.8.8) or applications could easily ignore the /etc/hosts file if they only make DNS requests and do not go through the system resolver.



    % host example.com
    example.com has address 93.184.216.34
    example.com has IPv6 address 2606:2800:220:1:248:1893:25c8:1946





    share|improve this answer
























    • I added one more line: 0.0.0.0 asdf.com Now host asdf.com prints asdf.com has address 64.90.40.65 and dns-sd -G v4 asdf.com prints 19:59:37.634 Add 2 -1 asdf.com. 0.0.0.0 1 Does this mean that my system completely ignores /etc/hosts?

      – dnnagy
      Mar 6 '18 at 19:01





















    0














    OSXDaily has a different command set for High Sierra - maybe worth a try...



    sudo killall -HUP mDNSResponder; sleep 2; echo macOS DNS Cache Reset | say



    or if it's being sticky...



    sudo killall -HUP mDNSResponder && echo macOS DNS Cache Reset






    share|improve this answer































      -1














      I had this problem as well. It turns out I forgot to specify the port number my app was running on in the browser URL (e.g. www.mywebsite.com:1234).






      share|improve this answer










      New contributor




      Shide Foo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.




















        Your Answer








        StackExchange.ready(function() {
        var channelOptions = {
        tags: "".split(" "),
        id: "3"
        };
        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: true,
        noModals: true,
        showLowRepImageUploadWarning: true,
        reputationToPostImages: 10,
        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%2fsuperuser.com%2fquestions%2f1301006%2fetc-hosts-not-working-on-macos-10-13%23new-answer', 'question_page');
        }
        );

        Post as a guest















        Required, but never shown

























        4 Answers
        4






        active

        oldest

        votes








        4 Answers
        4






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes









        1














        I had the hosts and IP addresses separated by tabs, switching to just one space between them worked for me:



        127.0.0.1 www3.mytestsite.com





        share|improve this answer




























          1














          I had the hosts and IP addresses separated by tabs, switching to just one space between them worked for me:



          127.0.0.1 www3.mytestsite.com





          share|improve this answer


























            1












            1








            1







            I had the hosts and IP addresses separated by tabs, switching to just one space between them worked for me:



            127.0.0.1 www3.mytestsite.com





            share|improve this answer













            I had the hosts and IP addresses separated by tabs, switching to just one space between them worked for me:



            127.0.0.1 www3.mytestsite.com






            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Oct 6 '18 at 18:43









            MrAn3MrAn3

            1112




            1112

























                0














                Works for me on a 10.13.3 system.



                % grep example /etc/hosts
                127.0.0.1 example.com
                % perl -MSocket -e 'printf "%vxn", inet_aton "example.com"'
                7f.0.0.1
                % dns-sd -G v4 example.com
                DATE: ---Tue 06 Mar 2018---
                10:49:47.455 ...STARTING...
                Timestamp A/R Flags if Hostname Address
                TTL
                10:49:47.457 Add 2 -1 example.com. 127.0.0.1
                1
                ^C


                However! Some applications (e.g. Google Chrome) may make their own queries to their own DNS servers (e.g. to 8.8.8.8) or applications could easily ignore the /etc/hosts file if they only make DNS requests and do not go through the system resolver.



                % host example.com
                example.com has address 93.184.216.34
                example.com has IPv6 address 2606:2800:220:1:248:1893:25c8:1946





                share|improve this answer
























                • I added one more line: 0.0.0.0 asdf.com Now host asdf.com prints asdf.com has address 64.90.40.65 and dns-sd -G v4 asdf.com prints 19:59:37.634 Add 2 -1 asdf.com. 0.0.0.0 1 Does this mean that my system completely ignores /etc/hosts?

                  – dnnagy
                  Mar 6 '18 at 19:01


















                0














                Works for me on a 10.13.3 system.



                % grep example /etc/hosts
                127.0.0.1 example.com
                % perl -MSocket -e 'printf "%vxn", inet_aton "example.com"'
                7f.0.0.1
                % dns-sd -G v4 example.com
                DATE: ---Tue 06 Mar 2018---
                10:49:47.455 ...STARTING...
                Timestamp A/R Flags if Hostname Address
                TTL
                10:49:47.457 Add 2 -1 example.com. 127.0.0.1
                1
                ^C


                However! Some applications (e.g. Google Chrome) may make their own queries to their own DNS servers (e.g. to 8.8.8.8) or applications could easily ignore the /etc/hosts file if they only make DNS requests and do not go through the system resolver.



                % host example.com
                example.com has address 93.184.216.34
                example.com has IPv6 address 2606:2800:220:1:248:1893:25c8:1946





                share|improve this answer
























                • I added one more line: 0.0.0.0 asdf.com Now host asdf.com prints asdf.com has address 64.90.40.65 and dns-sd -G v4 asdf.com prints 19:59:37.634 Add 2 -1 asdf.com. 0.0.0.0 1 Does this mean that my system completely ignores /etc/hosts?

                  – dnnagy
                  Mar 6 '18 at 19:01
















                0












                0








                0







                Works for me on a 10.13.3 system.



                % grep example /etc/hosts
                127.0.0.1 example.com
                % perl -MSocket -e 'printf "%vxn", inet_aton "example.com"'
                7f.0.0.1
                % dns-sd -G v4 example.com
                DATE: ---Tue 06 Mar 2018---
                10:49:47.455 ...STARTING...
                Timestamp A/R Flags if Hostname Address
                TTL
                10:49:47.457 Add 2 -1 example.com. 127.0.0.1
                1
                ^C


                However! Some applications (e.g. Google Chrome) may make their own queries to their own DNS servers (e.g. to 8.8.8.8) or applications could easily ignore the /etc/hosts file if they only make DNS requests and do not go through the system resolver.



                % host example.com
                example.com has address 93.184.216.34
                example.com has IPv6 address 2606:2800:220:1:248:1893:25c8:1946





                share|improve this answer













                Works for me on a 10.13.3 system.



                % grep example /etc/hosts
                127.0.0.1 example.com
                % perl -MSocket -e 'printf "%vxn", inet_aton "example.com"'
                7f.0.0.1
                % dns-sd -G v4 example.com
                DATE: ---Tue 06 Mar 2018---
                10:49:47.455 ...STARTING...
                Timestamp A/R Flags if Hostname Address
                TTL
                10:49:47.457 Add 2 -1 example.com. 127.0.0.1
                1
                ^C


                However! Some applications (e.g. Google Chrome) may make their own queries to their own DNS servers (e.g. to 8.8.8.8) or applications could easily ignore the /etc/hosts file if they only make DNS requests and do not go through the system resolver.



                % host example.com
                example.com has address 93.184.216.34
                example.com has IPv6 address 2606:2800:220:1:248:1893:25c8:1946






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 6 '18 at 18:54









                thrigthrig

                63646




                63646













                • I added one more line: 0.0.0.0 asdf.com Now host asdf.com prints asdf.com has address 64.90.40.65 and dns-sd -G v4 asdf.com prints 19:59:37.634 Add 2 -1 asdf.com. 0.0.0.0 1 Does this mean that my system completely ignores /etc/hosts?

                  – dnnagy
                  Mar 6 '18 at 19:01





















                • I added one more line: 0.0.0.0 asdf.com Now host asdf.com prints asdf.com has address 64.90.40.65 and dns-sd -G v4 asdf.com prints 19:59:37.634 Add 2 -1 asdf.com. 0.0.0.0 1 Does this mean that my system completely ignores /etc/hosts?

                  – dnnagy
                  Mar 6 '18 at 19:01



















                I added one more line: 0.0.0.0 asdf.com Now host asdf.com prints asdf.com has address 64.90.40.65 and dns-sd -G v4 asdf.com prints 19:59:37.634 Add 2 -1 asdf.com. 0.0.0.0 1 Does this mean that my system completely ignores /etc/hosts?

                – dnnagy
                Mar 6 '18 at 19:01







                I added one more line: 0.0.0.0 asdf.com Now host asdf.com prints asdf.com has address 64.90.40.65 and dns-sd -G v4 asdf.com prints 19:59:37.634 Add 2 -1 asdf.com. 0.0.0.0 1 Does this mean that my system completely ignores /etc/hosts?

                – dnnagy
                Mar 6 '18 at 19:01













                0














                OSXDaily has a different command set for High Sierra - maybe worth a try...



                sudo killall -HUP mDNSResponder; sleep 2; echo macOS DNS Cache Reset | say



                or if it's being sticky...



                sudo killall -HUP mDNSResponder && echo macOS DNS Cache Reset






                share|improve this answer




























                  0














                  OSXDaily has a different command set for High Sierra - maybe worth a try...



                  sudo killall -HUP mDNSResponder; sleep 2; echo macOS DNS Cache Reset | say



                  or if it's being sticky...



                  sudo killall -HUP mDNSResponder && echo macOS DNS Cache Reset






                  share|improve this answer


























                    0












                    0








                    0







                    OSXDaily has a different command set for High Sierra - maybe worth a try...



                    sudo killall -HUP mDNSResponder; sleep 2; echo macOS DNS Cache Reset | say



                    or if it's being sticky...



                    sudo killall -HUP mDNSResponder && echo macOS DNS Cache Reset






                    share|improve this answer













                    OSXDaily has a different command set for High Sierra - maybe worth a try...



                    sudo killall -HUP mDNSResponder; sleep 2; echo macOS DNS Cache Reset | say



                    or if it's being sticky...



                    sudo killall -HUP mDNSResponder && echo macOS DNS Cache Reset







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Mar 6 '18 at 19:03









                    TetsujinTetsujin

                    15.8k53462




                    15.8k53462























                        -1














                        I had this problem as well. It turns out I forgot to specify the port number my app was running on in the browser URL (e.g. www.mywebsite.com:1234).






                        share|improve this answer










                        New contributor




                        Shide Foo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                        Check out our Code of Conduct.

























                          -1














                          I had this problem as well. It turns out I forgot to specify the port number my app was running on in the browser URL (e.g. www.mywebsite.com:1234).






                          share|improve this answer










                          New contributor




                          Shide Foo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                          Check out our Code of Conduct.























                            -1












                            -1








                            -1







                            I had this problem as well. It turns out I forgot to specify the port number my app was running on in the browser URL (e.g. www.mywebsite.com:1234).






                            share|improve this answer










                            New contributor




                            Shide Foo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                            Check out our Code of Conduct.










                            I had this problem as well. It turns out I forgot to specify the port number my app was running on in the browser URL (e.g. www.mywebsite.com:1234).







                            share|improve this answer










                            New contributor




                            Shide Foo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                            Check out our Code of Conduct.









                            share|improve this answer



                            share|improve this answer








                            edited 1 min ago









                            karel

                            9,28093239




                            9,28093239






                            New contributor




                            Shide Foo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                            Check out our Code of Conduct.









                            answered 12 mins ago









                            Shide FooShide Foo

                            1




                            1




                            New contributor




                            Shide Foo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                            Check out our Code of Conduct.





                            New contributor





                            Shide Foo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                            Check out our Code of Conduct.






                            Shide Foo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                            Check out our Code of Conduct.






























                                draft saved

                                draft discarded




















































                                Thanks for contributing an answer to Super User!


                                • 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%2fsuperuser.com%2fquestions%2f1301006%2fetc-hosts-not-working-on-macos-10-13%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

                                Why not use the yoke to control yaw, as well as pitch and roll? Announcing the arrival of...

                                Couldn't open a raw socket. Error: Permission denied (13) (nmap)Is it possible to run networking commands...

                                VNC viewer RFB protocol error: bad desktop size 0x0I Cannot Type the Key 'd' (lowercase) in VNC Viewer...