Check tutorial of How to Edit the Hosts File in Mac OS X with Terminal
therefore after a fortune of requests from our users here is a guide about How to Edit the Hosts File in Mac OS X with Terminal .
Should you edit or change the hosts file on a Mac ? This guide will show you precisely how to edit the hosts file in Mac OS. You will see hosts in Mac OS X are stored at / private / etc / hosts, but it can besides be accessed in the more traditional placement of / etc / hosts. That said, if you want to edit hosts, you need to target the file in / private / etc /.
We walk through it how to edit the hosts file manually in macOS Mojave, macOS Catalina, macOS high Sierra, macOS Sierra, OS X El Capitan, Yosemite, OS X Lion, OS X Mountain Lion and OS X Mavericks, this will be done with command line using the bare text editor called nano. however, don ’ t make the command line or Terminal good daunting because it isn ’ thymine, we ’ ll make the whole march of editing a Mac hosts file super simple .
How to Edit Hosts file on Mac OS
Let ’ s beginning making some edits to / etc / hosts in macOS and Mac OS X !
- Launch Terminal, found in / Applications / Utilities / or launched from Spotlight
- Type the following command at the prompt:
- Enter the administrator password when prompted, you won’t see it typed on the screen as usual with command line
- Once the hosts file is loaded into nano, use the arrow keys to navigate to the bottom of the hosts file to make your changes
- When done, press Control + O followed by ENTER / RETURN to save changes to / private / etc / hosts, then press Control + X to exit nano
- Exit Terminal when done
sudo nano / secret / etc / hosts
You can instantly verify your hosts ’ changes with pink, Safari, or another network app .
Changes take effect immediately, although some adjustments may need to be accompanied by a DNS flower that can be done with the following command in macOS 10.12+ through OS X 10.9 :
dscacheutil -flushcache ; sudo killall -HUP mDNSResponder
If you flush the DNS hoard with that command, you will need to enter the administrator password .
If you want to see how this whole process goes before doing it yourself, watch the video below to see a demonstration of the hosts file being modified on OS X to prevent the web site from becoming ‘ yahoo.com ’ loaded :
bill : The routine is the lapp with older versions of Mac OS X, although the path to hosts could be / etc / hosts if the translation of OS X is importantly outdated .
Tips things to consider when editing host files
The pursue tips go beyond OS X and apply it to any hosts file, be it on a Mac, Windows, or Linux .
- The preceding IP address is where the next domain will be resolved
- Always add new hosts to their own unique line
- The # symbol functions as a comment, it can be used to add comments to hosts entries or make changes to hosts
- You can block websites via hosts by adding them to the file and not sending them anywhere, preventing access
- You can redirect websites locally with the same logic, perfect for setup up test domains
- With some tweaks, it may be necessary to flush the DNS cache with dscacheutil for the changes to take effect
- Consider using a manager app like GasMask to juggle multiple hosts files
- If the hosts file claims to be locked, it is because you did not precede the operation with the “sudo” command
- Consider backing upup of hosts if you plan to make significant changes, or if it’s your first time editing the file (process outlined below)
Making a backupup of the hosts file can be a good idea if you plan on making major changes or if you just want to play around with changes to see what happens, an easily way to do that is to use this command, which you backup would store in your home ~ / Documents / folder :
sudo cp / private / etc / hosts ~ / Documents / hosts-backup
If you then want to restore the modified hosts to the backupup from the original file, you good need to swap the paths and rename the file again :
sudo cp ~ / Documents / hosts-backup / secret / etc / hosts
That ’ s it, although you may need to flush the DNS for the changes to take impression .
ultimately, it ’ sulfur worth mention that if you ’ d quite avoid the Terminal and command line completely, you can try the easier method of using a preference acid to change hosts content that means via System Preferences. In general, however, we recommend using entirely the tools that are built directly into the Mac .
Let us know in the comments if you have any questions or tips .
How to Edit the Hosts File in Mac OS X with Terminal Guide is free?
Starting from : free
This guide is a complimentary model
Free Trial : May be included, please check on the official site, we mentioned above.
The How to Edit the Hosts File in Mac OS X with Terminal tutorial price is release or Freemium. This means you can truly enjoy the How to Edit the Hosts File in Mac OS X with Terminal scout.
The How to Edit the Hosts File in Mac OS X with Terminal guide gives you an easy-to-use and efficient management and How to Edit the Hosts File in Mac OS X with Terminal allows you to focus on the most important things. It’s friendly guide to use maybe you will love it and How to Edit the Hosts File in Mac OS X with Terminal tutorial can be used on Linux, Windows or android devices.
How to Edit the Hosts File in Mac OS X with Terminal: benefits
- The How to Edit the Hosts File in Mac OS X with Terminal tutorial is free .
- Helps many users follow up with interest in a timely manner.
- The price of the How to Edit the Hosts File in Mac OS X with Terminal guide is free.
How to Edit the Hosts File in Mac OS X with Terminal: FAQ
Tutorial Summary: How to Edit the Hosts File in Mac OS X with Terminal
In this steer, we told you about How to Edit the Hosts File in Mac OS X with Terminal ; please read all steps therefore that you understand How to Edit the Hosts File in Mac OS X with Terminal in case if you need any aid from us, then contact us.
How this tutorial helping you?
so in this template, we discuss the How to Edit the Hosts File in Mac OS X with Terminal, which undoubtedly helps you.
What is actual time in which this method complete?
The fourth dimension to complete the How to Edit the Hosts File in Mac OS X with Terminal tutorial is 10+ minutes.
What are the supported Device?
Read more: How to Make Your Own Website Without a Host
What are the supported Operating system?
How to Edit the Hosts File in Mac OS X with Terminal Tutorial: final note
For our visitors : If you have any queries regards the How to Edit the Hosts File in Mac OS X with Terminal, then please ask us through the gossip incision below or directly touch us.
Education: This guide or tutorial is precisely for educational purposes.
Misinformation: If you want to correct any misinformation about the guidebook “ How to Edit the Hosts File in Mac OS X with Terminal ”, then kindly contact us.
Want to add an alternate method : If anyone wants to add the more methods to the guide How to Edit the Hosts File in Mac OS X with Terminal, then kindly contact us.
Our Contact : charitable use our touch page regards any help. You may besides use our sociable and accounts by following the Whatsapp, Facebook, and Twitter for your questions. We always love to help you. We answer your questions within 24-48 hours ( Weekend away ).
Channel: If you want the latest software updates and discussion about any software in your pocket, then here is our Telegram channel .