Zum Inhalt springen
Zur Hauptnavigation springen
Zum Footer springen

Change host file on Mac - 5 simple steps

updated on February 21, 2025
Storyboard drawings
Joachim Lackner
Author: Joachim Lackner

Owner & Managing Director of ithelps Digital. Since 2013, he has been deeply engaged in SEO and online marketing.

In this article, I'll show you how to change the hosts file on your Mac. Right at the beginning, I'll describe how you can make the changes. A little further down, I'll explain why you should change your hosts file in the first place.


How to change the host file on the Mac

1. Open the Terminal tool (Applications / Utilities / Terminal).
2. Enter the command "sudo nano /etc/hosts" (without inverted commas).
3. Enter your password from the Mac user (no characters are displayed).
4. Make your desired changes.
5. Press Ctrl+X, then Y and ENTER.

If the change does not work, restart your Mac or enter the command "sudo /usr/bin/dscacheutil -flushcache".

What happens if you change the host file? (Explained in an example)

I'll show you in an easy-to-understand example. Follow the instructions above and make the following entry in your host file:

185.56.87.133 www.orf.at (one space in between)

Your host file should then look like this:

Host Datei

Now save this file (see step 5 above).

Now open your browser and enter www.orf.at. You should now see a certificate error and then be redirected to our website www.ithelps-digital.com.

ithelps startseite

To undo this, simply delete the set entry from the host file.

Florian Prohaska im Business-Outfit - Co-Founder von ithelps

Dein Ansprechpartner:
Florian Prohaska - Co-Founder

Möchtest du mehr Kunden über das Internet gewinnen? Wir können helfen!

  • SEO: Sichtbarkeit und qualifizierten Traffic durch gezielte SEO-Strategien
  • Google Ads: Effektive Werbekampagnen für maximalen ROI.
  • Webdesign: Professionelles Design, das deine Besucher beeindruckt.
  • Webshops: Individuelle Lösungen für erfolgreiche Online-Shops.
  • Content-Erstellung: Wertvolle Inhalte, die Interessenten überzeugen.

In which situation you should change the host file

We change the host file very often. For example, whenever we change the host of a website and want to transfer the website. This allows us to transfer the website to the new host in advance without any downtime for the public or the customer.

Change host file when changing host

You want to switch from website host A to website host B. Your website can be accessed with www.deineseite.at and points to host A. If you were to carry out the switch immediately, www.deineseite.at would point to host B. However, your website is not yet there and your browser would display an error. You would then be under stress as you have to transfer the website "quickly".

The alternative is as follows:
I activate the hosting package with hoster B, but leave the domain www.deineseite.at still pointing to hoster A. I now receive an IP address for the new server from host B. I enter this IP address in my host file. This would then look like this:

Screenshot Host Datei

Every time I now enter www.deineseite.at, I am referred to host B. I can then transfer and test my website at my leisure. If everything is OK, I can point the domain from host A to host B.

I would recommend that you clean up the host file afterwards, i.e. delete the set entry.


Any questions?

If you have any further questions on the topic or would like professional support, feel free to get in touch with us. Send an email to office@ithelps-digital.com, call us at +43 1 353 2 353, or reach out for us on our contact page.



Share this article