MacOS – Where to insert a custom item in /etc/hosts file

hostsmacos

The default /etc/hosts file looks like this:

127.0.0.1   localhost
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost

If I want to insert a custom item, should I insert it after the first line?

127.0.0.1   localhost
127.0.0.1   website.dev
...

Or should I add it after the last line?

...
fe80::1%lo0 localhost
127.0.0.1   website.dev

I've seen both, but can anyone explain what the difference is?

Best Answer

You can add it anywhere you want in the body of the file.

Additionally the following works also:

127.0.0.1   localhost website.dev website.org

and for me even this works (but I don't think it's recommended):

127.0.0.1   localhost, website.dev, website.org

For the sake of a better overview I prefer:

127.0.0.1   localhost
127.0.0.1   website.dev
127.0.0.1   website.org
255.255.255.255 broadcasthost
...IPv6 stuff...