Etc Hosts For Mac



Hosts 1.2 for Mac is free to download from our software library. This software for Mac OS X is a product of ee.clockwise. The application relates to System Tools. From the developer: Hosts is a system preference pane to manage your hosts file. Hostbuddy is the easiest way to manage and update the /etc/hosts file on your Mac. Add new entries and turn on and off existing ones with one click. It's perfect for switching between staging and production servers or just for testing out your new website before it goes live. To open the hosts file use the command below (you can Copy and Paste it directly into the terminal window). Sudo nano /private/etc/hosts. Press the return key.Terminal will ask you for a password.Enter the Administrator password for your Mac. As you enter the password the characters will not appear on screen, this is a privacy feature included in Terminal, simply hit enter after you’ve.

  1. Mac Hosts File Not Working
  2. Etc/hosts Mac Finder
  3. Etc/hosts Mac Mojave
  4. Update Etc Hosts Mac

Ever heard of host files? Most of us often confuse host files with DNS files but they’re actually pretty different. So, before we jump on understanding how to edit hosts file on Mac first let’s understand the basic difference between hosts file and DNS.

Hosts File Vs DNS

Most of us are under a common impression of associating DNS with host files but the fact is they’re a lot different. DNS (Domain Name System) is basically a database or a huge directory which includes a list of which web address name belongs to which IP address.

The equivalent file is /private/etc/hosts. Example ## # Host Database # # localhost is used to configure the loopback interface # when the system is booting. Do not change this entry. ## 127.0.0.1 localhost 255.255.255.255 broadcasthost::1 localhost # Added by Docker Desktop 127.0.0.1 kubernetes.docker. Make sure the entry you added is properly formatted: IP address followed by a space or tab, followed by the name, then a linefeed at the end of the line. Try printing the hosts file with cat -vet /etc/hosts to make normally invisible characters visible. The line should look like '192.168.1.249^Iholub.com$' (the '^I' is a tab, and the '$' is the linefeed) or '192.168.1.249 holub.com$'.

On the other hand, hosts file are localized to a specific device. So, when we’re talking about Mac hosts file it is a pretty important document which maps hostnames to specified IP addresses. This concept is actually similar to how we store contact names on our smartphone. For instance, the contact name acts as a web address and the phone number is the IP address.

Editing Hosts Files on Mac

When it comes to editing hosts file on Mac, the concept is pretty simple. It’s like simply rerouting the IP address of a specific web address. We’ve often seen a message on browser saying “Cannot find the webpage which you’re looking for” right? This basically happens when a particular web address is linked to an incorrect IP address. It’s just like hitting a wrong number from your cell phone, when we try to reach a contact, the phone rings and still we ‘re unable to connect with the respective person due to incorrect entering of contact details.

Here are a few important benefits of editing hosts file on Mac that’ll help you in understanding this concept in a better manner.

10 Mac Terminal Commands You Should TryBeyond macOS skin, there’s a whole another world known as Mac command line. This article will describe how to use...

Benefits of Editing Hosts File on Mac

Once we reroute a web address to a specific IP address here are a few perks that you might experience:

Enhanced Productivity: If you’re running a small business, then blocking a few social media websites like Facebook, YouTube, Twitter can help your employees to stay focused on their work.

Network Testing: While developing a new network or developing a new website project, you can reroute the web address to a different IP address so that the real website doesn’t get affected while web development is in progress.

Block Malicious Websites: If you happen to know about any malicious web sites, then rerouting these web pages to a secure landing page can prevent your system from any potential threat.

Increased Speed: As the hosts file are localized to your Mac or a specific device, finding a web page can tremendously speed up your browsing experience as compared to DNS.

How to Edit Hosts File on Mac with Terminal

For

Before you proceed further on editing hosts file on Mac, make sure you have the administrator privileges of your device beforehand.

  1. Launch the Terminal on Mac either by via Spotlight search or Finder window.
  2. In the Terminal window, type: sudo nano /etc/hosts and hit enter. This command will allow you to access Nano text editor which is where we edit hosts file.
  3. Now here you need to enter the alternative IP address which you want the website to reroute. Then hit tab and then type the web page address or domain name. Suppose, if you want to block access to a website say YouTube, then enter an invalid IP address first like 001.0.0.100 hit tab and then type www.youtube.com.
  4. Save changes by tapping Control + O keys and then hit control + X to exit Nano text editor.
  5. Before you entire move out of terminal window type: sudo killall -HUP mDNSResponder and hit enter to clear all DNS caches.
Also Read:-
11 Best Free VPN For Mac in 2020Looking for privacy and security while surfing internet on Mac, then check out the free and best VPN services for...

How to Edit Hosts File on Mac with TextEdit

Another way for editing hosts file on Mac is via apart from using Mac terminal text editor is TextEdit.

  1. Navigate to Finder > Go > Go to Folder…
  2. Now type /private/etc/hosts and tap on Go.
  3. Copy the hosts file on your Mac’s desktop and then double click the file to make changes.
  4. Now just like we did on the terminal window, first type in the alternative IP address, hit tab, followed by a web page address.
  5. Once you’ve made the desired changes in the hosts file, save it and copy it back to the same location from where we fetched it, right back in the etc folder.
  6. Mac will prompt whether you want to replace this file with the previously existing one. Confirm and proceed further.
Best Security Tips And Tricks To Secure Your...Read this to know how you can secure your Mac as it is important to keep it in mind if...

So folks, here was a quick guide on how to edit Mac hosts file! We hope the above mentioned steps will help you in getting through!

For any other queries or feedback feel free to hit the comment box!

How to open and edit the hosts file on Mac computers?

All Mac computers store a small, text based file called 'hosts'. Modifying this file is sometimes necessary to solve connection problems, set your own web server, and instruct the system to block access to specific websites (thus to prevent opening malicious websites). There are many reasons why you might need modify this particular file, however, access to it is not generally via the desktop folder. The most common way to make changes to the host file is using the Terminal application. This works on all Mac operating system versions, although the path sometimes varies.

In the new version of macOS, you can also modify the hosts file via Finder and the text editor. Making changes to the hosts file may seem daunting but with a proper guidance it is straightforward and useful to perform certain operations. Despite this, in some cases users are unable to differentiate between the DNS server and hosts file. To clarify, we will describe the differences and provide methods to modify the hosts file depending on your Mac operating system version.

Table of Contents:

It is recommended to run a free scan with Malwarebytes - a tool to detect malware and fix computer errors. You will need to purchase the full version to remove infections and eliminate computer errors. Free trial available.

What is the difference between DNS and hosts file?

Firstly, we will clarify the difference between Domain Name System (DNS) server and the hosts file. Inexperienced computer users commonly mistake the DNS server and hosts file to be the same. Therefore, modifications made to the hosts file that should be applied to the DNS server (and vice versa) lead to problems.

A DNS server is a database that responds to websites URL addresses expressed in more meaningful characters. These servers finds the correct IP address assigned to the particular URL address and allow you to access the desired website. They also create a hidden cache file where this information is stored, thus increasing loading speed when you try to access a website that you have previously visited.

The hosts file is one of the easiest ways to modify or deny DNS server entries. It can be useful to test a web server under development, so that you can access it through a URL address, rather than its IP address. Within the hosts file, you can associate a particular IP address and Domain name (i.e. URL address). The Mac will open the IP address assigned to a particular URL address within the hosts file, ignoring the DNS server results. This is also an effective way to block unwanted websites. For example, if you are setting-up a new company computer and wish to prevent employees from accessing unnecessary websites (such as Facebook, Twitter, etc.), you simply assign invalid or other preferred addresses to these website URL addresses. As a further example, you can assign the invalid IP address 0.0.0.0 and URL www.facebook.com within the Mac host file - the computer will attempt to connect to the invalid IP addresses when the Facebook URL is entered. You can also assign your company homepage IP address, rather than an invalid IP. More detailed information about how to prevent Mac from accessing unwanted websites can be found in this article.

If you do not know the full IP address of a specific website, you can use Terminal and the command ping. Launch terminal via Spotlight, press the keyboard shortcut of Command and Spacebar, and type in Terminal. Type in the ping command with the URL address and press return. Within the results, you will find the website IP address. The example of the ping command listed below is: ping www.pcrisk.com

Modify hosts file via Finder

On modern versions of the Mac operating system, the hosts file might be accessible and modified in two separate ways. First, via Finder - by moving the file to your desktop or another unprotected are. Second, via the Terminal application. We begin with hosts file editing via Finder. Launch finder and click the Go option in the menu bar at top of your screen. Then select Go to Folder and type the following path and click Go:

  • /private/etc/hosts

By default, the 'etc' folder is protected against modification. Therefore, copy the hosts file to an unprotected location, for example, the desktop. There you will be able to modify the copy of the hosts file. Simply double click on the file to open it via the TextEdit application (or any other application able to open and modify text-based files).

At the top of the opened file, you will find comments (denoted by the hash [#] symbol). Anything placed on the same line that starts with this symbol is ignored by the system. In this way, comments and descriptions can be added to the file. Below the comment lines are the default IP addresses for localhost and broadcasthost. There might be other data, which is added by various applications. Enter your additional information below all existing entries. A common reason to modify the hosts file might be to block an unwanted websites from loading on your computer. Once you have finished editing, you must replace the original hosts file with this newly created version. Therefore, repeat the above procedure and go to the 'etc' folder.

Click the Go option in the menu bar at the top of the screen, select Go to Folder and type in the following path: /private/etc/hosts Click Go. Move the modified file to replace the old one. The operating system will ask you to authenticate to make changes within the protected folder. Click authenticate. You will now be asked to choose the action you wish to perform. Click Replace. Finally, you must enter the administrators account password to confirm your action. If you have blocked websites that already have been visited by this computer, you will need to flush DNS cache - detailed information can be found in this article.

Mac Hosts File Not Working

Modify hosts file using Terminal

Viewer

Modifying the hosts file via Terminal can save time spent moving the hosts file in and out of the protected 'etc' folder. In this case, however, you must work with the keyboard, rather than mouse or touchpad/trackpad. Using Terminal saves time spent moving the hosts file because you will be editing the original hosts file with super user permissions. Therefore, you are advised to create a backup of the hosts file, especially if you do not have experience of these techniques. Launch Terminal using Spotlight. Press the keyboard shortcut of Command and Spacebar. Type in Terminal and press Return. Alternatively, visit the Utilities folder under Applications via Finder to launch this built-in command line application.

Once Terminal is launched, type following command and press Return:

  • sudo cp /private/etc/hosts ~/Documents/hosts-backup

To restore the hosts file, use the following command and press Return to execute:

  • sudo cp ~/Documents/hosts-backup /private/etc/hosts
Hosts

Etc/hosts Mac Finder

Type the following command to access the hosts file by using a Unix text editor called nano. Press Return to execute the command. You will be asked to enter the administrators password to confirm access to super user permissions.

  • sudo nano /private/etc/hosts

Bear in mind that Terminal will not display any characters when you are entering the password. Simply type the password and press Return. The Terminal window will change. At the top, you will see the path of the hosts file, content, and control commands at the bottom of window. To navigate while using nano, use your keyboard arrow keys. Leave all existing information unchanged and type your additional data below (adding your data before the existing information could result in the application failing).

Etc/hosts Mac Mojave

Enter your data, each on a new line. Once you have finished editing the hosts file, press the keyboard shortcut of Control and O and then press Return to save changes within the existing file. Then press the shortcut of Control and X to exit the nano editor. For the changes to take effect, you will need to flush the DNS cache - detailed instructions can be found in this article.

Update Etc Hosts Mac

Video Showing how to modify hosts file on Mac