How to adjust your hosts file (Mac)

When you are creating a new website but don't want to make it live yet, it is possible to test your website locally. This can be done by making a (temporary) adjustment in the hosts file on your computer.

This adjustment directs the domain name you entered to a specific IP address, instead of the IP address determined by DNS.

Here's how you can do this on a Mac:

Step 1:

Open Terminal (via Spotlight).

MacTerminal.jpg

Step 2:

Enter the code sudo nano /etc/hosts and press Enter.

1.png

Step 3:

Enter your password and press Enter (it's normal that no characters appear on your screen).

4.png

Then the host database will open.

3.png

Step 4:

Enter the IP address and your domain name as follows:

45.82.188.XX
45.82.188.XX

2.png

Step 5:

Save the file using the keyboard shortcut Control + X.

Step 6:

Then press Y, followed by Enter.