Jan 01, 2013 Editing the Hosts file is a way for overriding DNS settings, and can be very useful for web development, or blocking a harmful domain. On Mac OS X, the Hosts file is used in much the same way as other operating systems. The difference is file location, and method of editing. Oct 19, 2014 How to Edit Hosts file in Mac OS X 10.10 Yosemite. How to Edit Hosts file in Mac OS X 10.10 Yosemite. How to, OS X Tagged With: block hosts, edit hosts file, Edit Hosts Yosemite, hosts, hosts file location yosemite, OS X 10.10 Yosemite. After I press Control+O I can’t find the host file because some folder are hidden in terminal.
![]()
The Hosts file basically translates domain names or NetBIOS names into IP addresses. It’s used for multiple purposes like blocking spyware and controlling the access to websites as well as network traffic. Based on your requirements, you can edit Hosts file on your Mac to remain in complete control.Before proceeding, there are a few things you need to keep in mind.
For instance, you must have the IP address of the device you want to send your Mac to, or the domain names you wish to keep your computer away from. Thanks to the Terminal app, working on Hosts file is a hassle-free experience. How to Edit Hosts File on MacStep #1. Launch Finder app on your Mac and then click on Applications from the sidebar. Next, double-click on Utilities. Then, double-click on Terminal as well.Or simply search Terminal in the Spotlight.Step #2. Now, enter the command: sudo nano /etc/hosts and then hit return.Step #3.
Next up, enter the administrator password and then press return.Step #4. Nano text editor will appear. Now, to add a new device or domain, simply move the cursor using the arrow keys and position it after the text in the window.While mapping an IP address on your local network to a domain, type in IP address, press ‘Tab’ on Keyboard and enter the domain name. (Make sure to enter all the possible combinations i.e. Www.facebook.com and facebook.com). To keep your computer away from certain sites, make sure to use “127.0.0.1.”.
127.0.0.1 will default to the local machine even if it has been assigned a different IP address by its router.Step #5. Next up, you need to hold down the control and O keys to save the file. Press enter/return key.Then, use control and X to exit.Most importantly, you need to flush the DNS. To do so, In the command line, enter sudo killall -HUP mDNSResponder Then, press return.
Enter your system password.It will flush the DNS cache of your computer. Video Walkthrough to Edit Hosts File on your MacThat’s all there is to it!Over to youSo, now you know how to make the best use of the Hosts file to keep malicious spyware at bay. Have any feedback? Do share it with us.You would like to read these posts as well:.Found this guide helpful?
And stay connected with us via, and to read more such articles.
Tutorial
Hey
On your Mac there is a hosts file that controls certain IP and domain addresses. It works in a similar way to a normal DNS server. It translates web addresses to IP addresses. This file enables you to change this link. As a result you can block certain domains from loading or just have a bit of fun. You should only use this file if you really need to, as well as this changing this file is a little bit complicated and if you are new to the Mac, I would recommend skipping this tutorial.
The hosts file is in the /etc folder. To access this file in Finder to to Go > Go To Folder, and type in /etc. A normal finder window will appear. In this window find the file called “hosts” double click this file and open it in TextEdit. At this point you should be enabled as a root user, so you can quickly edit the file.
In this file you should notice a couple of things, there should be a comment area at the top signified by hashes (#), and a couple of entries in the file. Do not change these. They are very important to operation of you computer. Your file should look like something below.
127.0.0.1 localhost
The IP address in on the left and the domain is on the right. You can now add more domains and IP addresses, one per line. For instance if you want to block an ad server you would type the following:
127.0.0.1 ad.doubleclick.net
This will send any requests from the doubleclick.net address to a blank adress. Although I don’t recommend you do this for blocking adverts, something like Adblock Plus is a lot better it can be used for practically anything. Say for example you have a program accessing the web, you can put an entry in the hosts file. As well as this it is also very good for blocking sites that you don’t want your kids accessing. If you have a web server set up, you can forward it to that IP address on your local network telling them they are accessing something they shouldn’t.
To make the changes stick, all you have to do is save the file and flush your cache. Using the methods described in this post, clear your cache in Terminal. Once you have completed, the command the changes should take effect.
If you want to find out more about DNS and all its related workings I recommend the DNS for Dummies, I recommended it in a previous post and many people have said it sa really useful book.
![]() ![]()
If you want to keep up with the latests post from Mac Tricks And Tips I recommend you subscribe to the RSS Feed.
Related posts:Where To Next?![]() Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
January 2023
Categories |