Modifying the Hosts file on a Mac computer can effectively control network access and solve DNS resolution problems。The following is a detailed modification tutorial:
1. Find the Hosts file
•Open Finder,Click the "Go" menu at the top,Select "Go to Folder"。
•enter /etc and press enter,Find and double-click to open the folder。
2. Back up Hosts file (optional)
• Found in the pop-up window hosts document,Right click and make a copy as a backup,In case the error can be restored after correcting it。
3. Edit Hosts file
•Will hosts Drag the file into a text editor (such as TextEdit、Sublime Text, etc.)。
•Add or edit the IP address and domain name information you need at the end of the file,The format is:IP address domain name,One entry per line。
4.Save changes
•After completing modifications,keep hosts document。If you are prompted for insufficient permissions,You can save the file as on your desktop,then drag it back /etc folder and overwrite the original file。
5. Flush DNS cache
Sudo Killall -hup Mdnsresponder
• Open the Terminal application (found in Utilities in the Applications folder),Enter the above command and press Enter key。

Comments (0)