The hosts file is used by your computer to map hostnames to IP addresses. By adding or removing lines to your hosts file you can change where certain domains will point when you access them in a browser. This can be used used for web development purposes, i.e. to redirect domains to local addresses.
Step 1: Launch Terminal
Step 2: Type the following command at the prompt to backup hosts file to documents folder:
Always make a Backup of your host file before making any changes just in case you make a mistake or typo
sudo cp /private/etc/hosts ~/Documents/hosts-backup
Step 3: Type the following command at the prompt to open hosts file:
sudo nano /private/etc/hosts
Step 4: Enter the administrator password when requested
Step 5: Once the hosts file is loaded, navigate to the bottom of the hosts file to make your modifications
Step 6: When finished, hit Control+O followed by ENTER/RETURN to save changes to /private/etc/hosts, then hit Control+X to exit out of nano
Step 7: Verify your hosts modifications.
Step 1: Launch Terminal
Step 2: Type the following command at the prompt to backup hosts file to documents folder:
Always make a Backup of your host file before making any changes just in case you make a mistake or typo
sudo cp /private/etc/hosts ~/Documents/hosts-backup
Step 3: Type the following command at the prompt to open hosts file:
sudo nano /private/etc/hosts
Step 4: Enter the administrator password when requested
Step 5: Once the hosts file is loaded, navigate to the bottom of the hosts file to make your modifications
Step 6: When finished, hit Control+O followed by ENTER/RETURN to save changes to /private/etc/hosts, then hit Control+X to exit out of nano
Step 7: Verify your hosts modifications.
I recently used this to setup PressPi on my Raspberry Pi.