Chapter in this post:
You are using the hosts file all the time, but most likely you will not even know about it. The reason for this is that you usually don't have to change anything. In my case, however, it is necessary to make a few entries every few weeks in order to avoid waiting times if I have to move a customer domain including website. How the hosts file comes into play is explained further down in the post, but for those people who don't want this information, I have here briefly the links to my two software recommendations.
On the Mac, the said file is under this path: /etc/hosts. If you want to change this, you usually have to go along with it Port and text editor and then clear the DNS cache. Depending on how often you have to do this, it can be very annoying. For this reason there is a program called "HostBuddy" that offers a nice GUI with DarkMode support for this type of work.
In HostBuddy you can easily create new entries for the hosts file and comment out other entries and refresh the DNS cache after the work is done - with a button. You still have to enter your administrator password for the Mac to carry out this job, but overall you are significantly faster with it than with the terminal - at least if you only work in the terminal in emergencies, as I do.
The HostBuddy software is currently available in the 2.0 version download here and use it first in the demo version. I have now bought the full version because I find the software extremely practical and want to support the developers. With version 2.0 you have brought a number of bug fies and also built in compatibility with the Mojave Darkmode.
If you want to change the hosts file under Windows 10, 8 or 7, you usually have to do this in this path:
C: \ Windows \ System32 \ drivers \ etc
But of course there is also a tool under Windows - and here even a freeware - which offers a comfortable way to change the hosts file. I haven't tried the software myself, but still wanted to leave it here as a recommendation for Windows users. If you want to download the program, you will find it here under the name HostsMan.
As already mentioned, I use HostBuddy when I move a website including a domain from one customer to another hoster. When you do this normally, the changes made to the DNS server spread across the network within a few hours. This means that you have a certain amount of time in which you can reach the old or the new server when calling up the domain. You can only find out which one you are currently querying if you use a ping command to check which IP address you are receiving or by making changes on one of the two servers and seeing whether they are displayed on the website.
But since I like to know whether the domain is running properly on the new server BEFORE I actually switch the domain to the new hosting, I can use HostBuddy to tell my Mac that it will call up the IP address of the new server when the domain is called up should. As a result, I can already see the website on the new hosting, while the rest of the world is still accessing the old hosting.
This is particularly helpful with content management systems such as WordPress, because there the domain appears in hundreds of places in the database and there is hardly any opportunity to test the website on the new server without the domain move. It's okay, but it's awkward.
If you want to impress your friends a bit, you can also route well-known domains such as www.google.com or www.apple.com on your own Mac. Instead of the real Apple or Google page, your own Mac is addressed and with a free software package such as MAMP or the web server built into macOS you can then display another website that you created yourself.
For the sake of completeness, I would like to briefly show the path that you have to take if you want to change the host file on the Mac with the terminal and the Nano-Editor:
Finished. Now you can see straight away how many steps a HostBuddy can save. You can simply make changes and click on "Apply Changes". ;-)
Jens has been running the blog since 2012. He appears as Sir Apfelot for his readers and helps them with problems of a technical nature. In his free time he drives electric unicycles, takes photos (preferably with his iPhone, of course), climbs around in the Hessian mountains or hikes with the family. His articles deal with Apple products, news from the world of drones or solutions for current bugs.