![switchhosts for mac switchhosts for mac](https://upload-images.jianshu.io/upload_images/728436-fe7926cf003c3491.png)
I've been a passionate evangelist for Apple and the Macintosh throughout my working life, my first love was a Quadra 605 working with a small creative agency in the south of Norfolk UK in the mid 1990's, I later progressed to other roles in other Macintosh dominated industries, first as a Senior graphic designer at a small printing company and then a production manager at Guardian Media Group. If you need to make any more changes to the hosts file you can simply repeat this procedure. You have also made sure the changes have been put in place by flushing your Mac’s DNS cache. You have now opened, edited and saved the hosts file on your Mac.
Switchhosts for mac mac#
Press the return key and you will flush your DNS cache and push through the changes you have made to the way in which your Mac resolves IP addresses from URLs.Ģ. Copy and Paste this command into the prompt: You can do this from the main Terminal window you currently have open.ġ.
Switchhosts for mac how to#
How to flush the DNS cacheīefore you changes will take place you will need to flush your Mac’s DNS cache. You can now exit this screen and return to the main Terminal window by pressing ctrl-x. Press the return key to save the changes you’ve made to the hosts file. Press ctrl-o and Terminal will open the correct “File Name to Write” at the bottom of the window.Ĥ. Use TAB to separate the IP address from the URL.Īt this point you could use the hosts file to block sites that serve adverts, to resolve your own website to a local IP address, or for any other function.ģ.
![switchhosts for mac switchhosts for mac](https://img.wervps.gedoucheng.com/wervps/mac-20220509/10142125_0221f3a1e936888.png)
In this case I have told the hosts file to locally resolve the address “” to the local IP address 127.0.0.1 (which will block me from accessing the site ). Enter the IP address and URL that you want the hosts file to map to. Ignore the comments separated by # marks and any existing entries.Ģ.
![switchhosts for mac switchhosts for mac](https://img3.appinn.net/static/wp-content/uploads/mzl-azpjahzf.jpg)
Use the arrow keys to navigate below the last entry. Once the hosts file has loaded it will look like this:ġ. How to edit and save changes to the hosts file
Switchhosts for mac password#
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 completed the password and the hosts file will load. Enter the Administrator password for your Mac. To open the hosts file use the command below (you can Copy and Paste it directly into the terminal window): You’ll see a window like this, though “macbook” will be replaced with the name of your Mac and “Mike” with your username.Ģ. You can either search for Terminal using Spotlight, or open in from your Applications -> Utilities folder. How to use Terminal to access the hosts fileġ. How to flush the DNS cache so that your changes are put in place.How to edit and save changes to the hosts file.How to use Terminal to access the hosts file.So make sure you have a good idea of why you need to edit the hosts file before following this guide. This is can be useful for blocking sites you suspect may be malicious or for locally testing websites whilst remaining offline.Įditing your hosts file requires using Terminal, and incorrectly editing the hosts file can have significant effects on how your Mac connects to the internet. With a little tinkering you can use the hosts file to make sure your Mac doesn’t resolve certain URLs via the DNS server. Normally your Mac doesn’t find what it’s looking for in the hosts file and quickly moves on to resolving the web address via the DNS (Domain Name System) server. Whenever you access a URL on the Internet your Mac checks the address against a list of IP addresses stored in the hosts file.