Tips to Edit Hosts File on macOS

Tips to Edit Hosts File on macOS

Hello Geeky, so today we are focusing on How to Edit Hosts File on macOS. So please read this tutorial carefully so you may comprehend it in a better helpful way.

Guide: How to Edit Hosts File on macOS

The host file is used by your computer to locate / resolve domain names to a specific IP address. This file can be used to force your computer to resolve your website to a specific IP address rather than resolving your website using the DNS found in the name servers that the domain refers to. Manually configuring your domain with the IP address of your InMotion hosting server, will allow you to test your website without affecting the server where your domain is referenced by the name server / DNS.

Editing your host file can be useful if running tests on your network. By mapping an IP address to a server name (or domain name), you can ignore the process where a web browser uses the Domain Name Server (DNS) search to translate the domain name to that IP address.

The Company Name System

When you enter the domain name of a website you want to visit many occur after events. Every web site, each service, almost every device connected to the Internet has a unique numeric address that tells all other devices where it is located – your TCP / IP address. The Domain Name System (DNS) translates those numeric addresses into something a little more identifiable and memorable to the person, viz. ”

The first time you enter a web address, your Mac pings a DNS server – usually one that is automatically configured for you by your Internet Service Provider – to find the TCP / IP address of the server you are trying to connect to. Your Mac refuses up hidden cache file to remember those details later when you visit the same site again.

The host file

Your Company Name settings and your associated cache are the clean path of your Mac how to to your destination on the Internet, but there is another file that can be very useful. It is called the Hosts file, and can be used to overcome default DNS information.

There are a few practical reasons why you may want to use the Hosts file instead of letting DNS do your thing. Let’s say you are testing a development server you want to transfer, and you want to use your domain name instead of the specific IP address of the device. Before setting up the Internet and accessing anyone using DNS, you can use the Host file instead: Enter the device’s IP address and when you use that domain name, your Mac will go to that device instead.

How to edit file hosts

You will need to know the IP address of the device you want to send your Mac to, or the domain names you are trying to hide from your Mac. The best way to work with the Host file is by using the Terminal application found in your Mac Applications folder. You can search for Terminal using Spotlight or by selecting Finder.

  • Open a Finder window.
  • Select Applications from the group.
  • Double click on Applications.
  • Click Terminal twice.

In the Terminal window, you will need to enter the command to open the Nano text editor. You will need your administrator password, as well.

  • type sudo nano / etc / hosts and then hit return.
  • Enter your administrator password and then type again.

It is now in the Nano text editor. You should see something like this:

If you want to add a new device or area, move the cursor using the arrow keys and place it behind the text in the window. Then, start typing. If you are mapping a specific IP address on your local network to a domain, you can enter the IP address, hit the tab, and then enter the domain name.

Alternatively, if you want to make sure a web URL does not go to your intended destination – if you are trying to delete your Mac from certain sites, use “127.0.0.1.” That will take your picture back to your Mac. Even if your Mac has chosen a different IP address through your router, 127.0.0.1 default to the local device thanks to the default settings in the cable file. Once done, hold down control and the O keys to save the file, then manage and X to exit.

One last step

Back in command line, type sudo killall -HUP mDNSResponder then press back. That will break the Mac DNS cache of your Mac, so you will not be bothered by any changes you have made to the Host file.

Do not forget that you have updated the Soldiers file, because at some point you may need to change the changes you have made in order to make your Mac work properly.

How to restart your Mac Soldiers file

When you are ready to restore your changes and restore them to the location of your Mac Soldiers file paths, you can do so by replacing the current host file with a new set of rules. You do not need a Terminal for this configuration.

  • Make sure you select Finder on your Mac.
  • Click on Go in Mac menu tool.
  • Click on Go to Folder.
  • Enter / private / etc / hosts into the search field.
  • Click Go.
  • Drag the Host file from the Finder window on your desktop.
  • Open the Hosts file from your desktop. It should open to TextEdit by default.
  • Delete the contents of your Soldiers file.
  • Paste the following into the same file:
  • Click Save.
  • Drag the same hosts file from your desktop back to the same folder. If you no longer have an open folder in the browser, follow steps one to five to reopen it.
  • Click Replace when asked if you want to replace the file.
  • Enter your Admin password when ready (that is the password the first user used to unlock their Mac).
  • Restart your Mac.

Faq

Guide about How to Edit Hosts File on macOS


In this guide, we told you about the How to Edit Hosts File on macOS; please read all steps above so that you understand How to Edit Hosts File on macOS in case if you need any assistance from us, then contact us.

How this tutorial or guide assisting you?


So in this guide, we discuss the How to Edit Hosts File on macOS, which undoubtedly benefits you.



Final note

I hope you like the guide How to Edit Hosts File on macOS. In case if you have any queries regards this article/tutorial you may ask us. Also, please share your love by sharing this article with your friends and family.

Trickbugs: Get the latest Trick and Tips
Logo
Enable registration in settings - general