Editing the host file on a Mac

This is pretty basic in the dev world–editing a host file– but I’ve had to type up these instructions waaaaaay too often to send to our Marketing department. This post is purely just for me to send to them and be like here you go!!

Updating the host file on a Mac:

  1. Open up the Global Spotlight search (Cmd+Space)
  2. Type ‘Terminal’. You should see it under Applications. Open it. 
  3. Once it opens, type out the following: sudo nano /etc/hosts   … and hit enter. It will ask for a password. Use the one you use when you unlock your computer.
  4. Using the arrow buttons, navigate your cursor to the bottom of the list and type in the IP and site you want it set to (dev will tell you…). For example:
    127.0.0.1 test.local.com
  5. To save your changes with the new entry, press ^+O (the letter-not number) and hit enter. 
  6. To exit the file, hit ^+X . This will close the file safely.
  7. To close Terminal, either type out exit or just exit the application like normal.