Step 1: Launch Terminal, found in /Applications/Utilities/ or launched through Spotlight.
Step 2: Enter the command – > sudo nano /etc/hosts
Step 3: Enter the administrator password when requested, you will not see it typed on screen as usual with the command line.
Step 4: Once the host file is loaded within nano, use the arrow keys to navigate to the bottom of the host file to make your modifications.
Step 5: Add the following
100.100.100.100 domainname.com www.domainname.com
Step 6: When finished, press Control+O followed by ENTER/RETURN to save changes to /etc/hosts, then press Control+X to exit out of nano.
Step 7: For the website to work with the actual IP address again, you need to undo the changes you have done in the /etc/hosts.