How To Edit Hosts File in Mac OS

The hosts file is one of the important network files of any operating system. We all know about DNS, which maps I.P. address to a domain address. For example, when you type dollarmind.com.ng in your browser URL, your internet connection queries DNS system of your I.S.P. to find the I.P. address and thus serve website in your browser.

This also brought the concept of Public DNS, which I have already discussed in detailed earlier (Using Google DNS to speed up The internet). Similarly, Hosts file is for your local computer.

You can add custom detail in your Hosts file, and before checking DNS, your system will check operating system hosts file for any reference. For example, if you add Google.com I.P. address for Facebook.com domain in your OS Hosts files, when ever someone will type Facebook.com in the browser URL, Google.com will be open in the browser. (A great idea for prank too). Anyways, I will not get into detailed explanation of DNS and Hosts files, but if you are interested to learn these basics (you should)

Editing Hosts file in Mac using Nano:

At the time of writing this article, I’m using Mac 10.8.4, and whenever I try to edit the hosts file using Text editor, I see the Locked error. I couldn’t find any option to unlock the Hosts files, and edit it using Mac Text Editor. Here is the error that I got, while trying to edit hosts file:

You don’t own the file “hosts” and don’t have permission to write to it.

How To Edit Hosts File in Mac OS

This is the default location of hosts files in Mac OS X:

/private/etc/hosts

And, here is the way to edit the file. Open terminal and type this command:

sudo nano /private/etc/hosts

And it will ask your system password once you enter the password, you will see a screen like this:

How To Edit Hosts File in Mac OS

Nano is the terminal editor, and if you wish to learn all the commands of this editor, here is a handy reference. Now, use your cursor to move, and edit the hosts files according to your requirement. Once you are done making changes, click on

  • Ctrl+ 0 : Click Enter after that. (This will save your output)
  • Ctrl + X: This will exit the Nano editor.

Update: You can download this Mac app call Gasmasks to edit hosts file quickly.

It took me 15 minutes to find the solution to locked hosts files issue in Mac, and I hope this article will save your precious time. If you are still stuck or have any question, feel free to ask me via comments. Do check out our other articles on general-tech, and you will learn something new today.

Sharing is Caring, also use the comment section for any Contributions and further questions

Bukason

41 thoughts on “How To Edit Hosts File in Mac OS

  1. Wonderful site you have here but I was curious about if you knew of any message boards that cover the same topics talked about here? I’d really love to be a part of online community where I can get feedback from other experienced individuals that share the same interest. If you have any suggestions, please let me know. Thanks!|

  2. Way cool! Some very valid points! I appreciate you penning this article and the rest of the website is really good.|

  3. Hi there! Do you use Twitter? I’d like to follow you if that would be ok. I’m absolutely enjoying your blog and look forward to new updates.|

  4. Simply wish to say your article is as amazing. The clarity to your publish is just cool and that i could think you are knowledgeable on this subject. Well with your permission let me to snatch your RSS feed to keep up to date with imminent post. Thanks one million and please keep up the enjoyable work.|

  5. It’s remarkable to visit this web site and reading the views of all mates on the topic of this post, while I am also keen of getting know-how.|

  6. Hmm is anyone else encountering problems with the pictures on this blog loading? I’m trying to figure out if its a problem on my end or if it’s the blog. Any feedback would be greatly appreciated.|

  7. hi!,I really like your writing so a lot! share we keep up a correspondence extra about your post on AOL? I require an expert in this space to solve my problem. May be that is you! Having a look forward to peer you. |

  8. Hi there, just became aware of your blog through Google, and found that it’s truly informative. I’m going to watch out for brussels. I will be grateful if you continue this in future. A lot of people will be benefited from your writing. Cheers!|

  9. I’m not sure where you are getting your information, but great topic. I needs to spend some time learning more or understanding more. Thanks for fantastic information I was looking for this information for my mission.|

  10. Hi! I’ve been following your blog for some time now and finally got the bravery to go ahead and give you a shout out from Lubbock Texas! Just wanted to say keep up the great work!|

  11. If some one wants to be updated with latest technologies therefore he must be pay a visit this web page and be up to date all the time.|

  12. I do not know whether it’s just me or if everybody else encountering problems with your website. It looks like some of the text in your posts are running off the screen. Can somebody else please provide feedback and let me know if this is happening to them as well? This might be a issue with my browser because I’ve had this happen previously. Cheers|

  13. Article writing is also a fun, if you be acquainted with afterward you can write or else it is complicated to write.|

  14. Having read this I believed it was really enlightening. I appreciate you finding the time and effort to put this content together. I once again find myself spending way too much time both reading and posting comments. But so what, it was still worthwhile!|

  15. Very good information. Lucky me I ran across your site by accident (stumbleupon). I’ve book marked it for later!|

  16. Howdy, i read your blog occasionally and i own a similar one and i was just wondering if you get a lot of spam comments? If so how do you prevent it, any plugin or anything you can recommend? I get so much lately it’s driving me crazy so any support is very much appreciated.|

  17. each time i used to read smaller articles or reviews which as well clear their motive, and that is also happening with this post which I am reading at this place.|

  18. I’m not sure where you are getting your info, but great topic. I needs to spend some time learning more or understanding more. Thanks for fantastic information I was looking for this information for my mission.|

  19. An interesting discussion is definitely worth comment. There’s no doubt that that you ought to publish more on this subject, it may not be a taboo matter but typically folks don’t speak about such topics. To the next! All the best!!|

  20. With havin so much written content do you ever run into any problems of plagorism or copyright violation? My site has a lot of exclusive content I’ve either written myself or outsourced but it looks like a lot of it is popping it up all over the web without my permission. Do you know any solutions to help reduce content from being ripped off? I’d definitely appreciate it.|

  21. Wow that was unusual. I just wrote an extremely long comment but after I clicked submit my comment didn’t show up. Grrrr… well I’m not writing all that over again. Anyways, just wanted to say excellent blog!|

  22. Hmm it seems like your blog ate my first comment (it was extremely long) so I guess I’ll just sum it up what I wrote and say, I’m thoroughly enjoying your blog. I as well am an aspiring blog writer but I’m still new to the whole thing. Do you have any points for novice blog writers? I’d definitely appreciate it.|

  23. Hi there fantastic website! Does running a blog such as this take a massive amount work? I’ve very little knowledge of programming however I had been hoping to start my own blog soon. Anyhow, if you have any recommendations or tips for new blog owners please share. I know this is off subject nevertheless I simply had to ask. Thanks a lot!|

  24. Pretty nice post. I just stumbled upon your weblog and wished to say that I have really enjoyed surfing around your blog posts. In any case I will be subscribing to your rss feed and I hope you write again soon!|

  25. I have been exploring for a little for any high quality articles or weblog posts in this sort of space . Exploring in Yahoo I at last stumbled upon this web site. Studying this information So i’m happy to express that I’ve an incredibly excellent uncanny feeling I came upon exactly what I needed. I so much definitely will make sure to do not forget this web site and give it a glance regularly.|

  26. Fantastic goods from you, man. I’ve understand your stuff
    previous to and you’re just too wonderful. I actually like
    what you have acquired here, certainly like what you are
    stating and the way in which you say it. You make it entertaining and you still take care of to keep
    it smart. I can’t wait to read much more from you. This is actually a terrific site.

Leave a Reply

Your email address will not be published. Required fields are marked *