Tutorial on modifying Hosts file on macOS:Easily manage network access permissions
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"。 •Type /etc and press enter,Find and double-click to open the folder。 2. Back up the Hosts file (optional) • Find the hosts file in the pop-up window,Right click and make a copy as a backup,In case the error can be restored after correcting it。 3. Edit the Hosts file • Drag the hosts file to 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 changes,Save hosts file。If you are prompted for insufficient permissions,You can save the file as on your desktop,Then drag it back to the /etc folder and overwrite the original file。 5. Flush the 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。
