Guide: How to Edit Hosts File in Mac OS X

The Mac hosts file is an important text document on Mac OS X that allows host names to be mapped to a specified IP address. While the internet has both public and private DNS servers for assigning IP addresses, the hosts file on Mac is a good way to ignore DNS servers. When editing the Hosts file on Mac, users can manually direct a website address to a specific IP address or block access to a site altogether by pointing to an unused or internal IP address. The following users will learn how to edit the Mac hosts file on OS X.

Edit Mac Hosts file with edit text

There are a number of different ways to edit the hosts file in Mac OS X. One method is to use the default Text editor feature for editing Mac host files. Since the Mac hosts file is a text document, using TextEdit is a sufficient tool as a Mac hosts file editor. But it is important to note that TextEdit cannot open the file directly and you must copy the file to an unprotected location such as the desktop, edit it and then copy it to TextEdit to edit the hosts file on the Mac . To find the hosts file, open Finder and select from Finder’s menu bar Go> Go to Folder. Type the following location in the box and press Return. / private / etc / hosts A new Finder window will open and your Mac’s hosts file will be selected. Click and drag it out of the Finder window and drop it on your desktop. This allows us to freely edit the file.

To open the default Mac hosts file, just double-click and the contents of the file will be displayed in TextEdit. By default, the hosts file is simple, as it contains only a few lines of descriptive text “commented out” with the hash or hash (#) sign. The host file also has IP values ​​for localhost and broadcast host. To edit the file, add your own rules after broadcast host.

Good use of an edited hosts file on your Mac is to block access to specific websites. (How to Block a website on WindowsIt is required to enter the IP address to be blocked and to assign followed by a host name. In our case, we want to block YouTube. You map www.youtube.com to 0.0.0.0, which as invalid IP address will result in an error. Whenever someone using the Mac tries to go to www.youtube.com, the web browser cannot load the page. Another method is to type in the IP address of a valid site instead of 0.0.0.0. To find the IP address of a website, you can “ping” the site via Terminal. Open Terminal and type the following command, replacing “www.website.com” with the website of your choice: ping www.website.com After the changes are made to the hosts files on the Mac, save them to the current location on the desktop. Then drag the hosts file from your desktop back to its original location / private / etc.. If the Finder window is closed, use the Finder> Go> Go to Folder command, to reopen it. After the hosts file has been dropped to its original location, OS X will ask you what to do with the unmodified hosts file that is already there. Choose “Replace” and then enter the administrator password to authenticate the transfer. Now open a web browser to test the changes. Correct changes did not occur, you may need to clear the DNS cache. For OS X Lion and OS X Mountain Lion, open Terminal and use the following command. Note that you will need to enter your administrator password to run it: sudo killall -HUP mDNSResponder Instead, use this command for OS X Mavericks: dscacheutil -flushcache; sudo killall -HUP mDNSResponder

How to Edit Hosts File in Mac OS X: benefits

Faq

Final note

I hope you like the guide How to Edit Hosts File in Mac OS X. In case if you have any query regards this article you may ask us. Also, please share your love by sharing this article with your friends. For our visitors: If you have any queries regards the How to Edit Hosts File in Mac OS X, then please ask us through the comment section below or directly contact us. Education: This guide or tutorial is just for educational purposes. Misinformation: If you want to correct any misinformation about the guide “How to Edit Hosts File in Mac OS X”, then kindly contact us. Want to add an alternate method: If anyone wants to add more methods to the guide How to Edit Hosts File in Mac OS X, then kindly contact us. Our Contact: Kindly use our contact page regards any help. You may also use our social and accounts by following us on Whatsapp, Facebook, and Twitter for your questions. We always love to help you. We answer your questions within 24-48 hours (Weekend off). Channel: If you want the latest software updates and discussion about any software in your pocket, then here is our Telegram channel.

How to Edit Hosts File on Mac OS X  2022  - 12How to Edit Hosts File on Mac OS X  2022  - 83How to Edit Hosts File on Mac OS X  2022  - 48How to Edit Hosts File on Mac OS X  2022  - 3How to Edit Hosts File on Mac OS X  2022  - 55How to Edit Hosts File on Mac OS X  2022  - 43