TechSpace Knowledgebase
Search:     Advanced search
Browse by category:
Contact Us

How to edit your Mac's Hosts file and why you would want to

Views: 18
Votes: 0
Posted: 15 Dec, 2018
by: Poh-ek C.
Updated: 16 Dec, 2018
by: Poh-ek C.

You'll need to know the IP address of the device you'd like to send your Mac to, or the domain names you're trying to keep your Mac away from. The best way to work with the Hosts file is using the Terminal application found in your Mac's Utilities folder. You can search for Terminal using Spotlight or by selecting it in Finder.

  1. Open a Finder window.
  2. Select Applications from the sidebar.

    Open Finder, then click on Applications

  3. Double-click on Utilities.
  4. Double-click Terminal.

    Double-click on Utilities, then double-click on Terminal

      In the Terminal window, you will need to enter a command to open the Nano text editor. You will need your administrator password, as well.

  1. type sudo nano /etc/hosts and then hit return.
  2. Enter your administrator password and then hit return.

    Enter enter Nano Text Editor in Terminal

You're now in the Nano text editor. You should see something that looks like this:

Map the IP address in the Nano text editor

     If you want to add a new device or domain, move the cursor using the arrow keys and position it after the text in the window. Then, begin typing.

If you're mapping a particular IP address on your local network to a domain, you can type the IP address, hit tab, then type the domain name.

Conversely, if you'd like to make sure a web URL doesn't go to its intended site if you're trying to keep your Mac away from certain sites, use "127.0.0.1." That'll map it back to your Mac. Even if your Mac is assigned a different IP address by its router, 127.0.0.1 defaults to the local machine thanks to the default settings in that hose file.

Once you're done, hold down the control and O keys to save the file, then control and Xto exit.

One last step

     Back at the command line, type sudo killall -HUP mDNSResponder then type return. That will flush your Mac's DNS cache, so it doesn't get confused by any changes you've made to the Hosts file.

sudo killall -HUP mDNSResponder

Don't forget you've modified the Hosts file, because at some point you may need to undo the changes you've made in order to keep your Mac working right.

Cr. https://www.imore.com/how-edit-your-macs-hosts-file-and-why-you-would-want

Others in this Category
document How to Install Windows on a Mac With Boot Camp
document Introduction to the Mac OS X Command Line
document How to reinstall OS X from recovery
document How to repairing a Boot Disk with Disk Utility
document How to Create Bootable USB From a Windows ISO for Mac
document How to Reinstall OS X from Recovery
document Safari crashing when typing in search bar
document How to find out the charge cycle count on an Apple Mac
document Zip files do not unzip Mac OSX
document How to Fix iTunes Error 3194 Successfully on iPhone/iPad/iPod
document Reset the System Management Controller (SMC) on your Mac
document Move a PiP Video Player Window Anywhere on Mac
document Sort Folders and Files on Mac Just Like Windows With a Single Setting Switch
document Create Hidden Administrative Accounts in OS X from the Terminal
document Six Keyboard Shortcuts Every Computer User Should Know
document How to Upgrade Your Computer's Login Screen
document How to Map a Network Drive on a Mac
document How to require a password for shared printers in OS X
document How to Switch from one language to another on Mac
document How to take a screenshot on your Mac
document Map a Network Drive on a Mac
document Use Disk Utility to Create a RAID 0 (Striped) Array
document Tired of the Apple logo on the back of your iPhone 6/6 Plus panel? Use this DIY to install cool LED in its place
document How to Verify and Repair a Disk From the OS X Command Line
document How to transfer photos from your iphon to a computer
document How to update Chrome On Mac
document How to install Windows 10 on a Mac
document Set up an email account on your iPhone, iPad, or iPod touch
document How to Add & Switch Languages in Mac OS X
document How to Manually Install Fonts on Your Mac
document How to Password Protect a Folder in a Mac
document How to Set Up Network File Sharing on macOS, Without Sharing Your Username and Password
document Use Preview to combine PDFs on your Mac
document How to use Hot Corners on Mac
document How to reset your Mac before selling it.
document How to use Continuity Camera on macOS Mojave and iOS 12.
document macOS Mojave: How to troubleshoot common problems
document Formatting External Hard Drive or USB Drive
document About the screens your Mac displays as it starts up.
document Mac startup key combinations.



RSS