How to Update Host File at MacOS
2022/11/031 min read
bookmark this
Table of Contents
Introduction
This is a simple memo on how to change the host file on macOS.
Terminal
Type the command below in a terminal on macOS:
nano /etc/hosts
Once the host file is opened, add a new line similar to the one below. This tells your macOS that whenever you type http://my.local.hostname, it will resolve to http://127.0.0.1 (localhost).
127.0.0.1 my.local.hostname
Conclusion
Editing the /etc/hosts file on macOS is straightforward using nano. Simply add a new line mapping your desired hostname to 127.0.0.1, save the file, and your local hostname will be ready to use.