Search Our Database
How to edit hosts file on Mac OS
Introduction
This guide is for Mac OS users who need to modify their hosts file for various purposes, such as mapping specific IP addresses to domain names, overriding DNS settings, or blocking access to certain websites. The hosts file is a plain text file used by the operating system to map hostnames to IP addresses. This tutorial will walk you through the process step-by-step, ensuring you can safely make changes to your hosts file. Editing the hosts file is especially useful for developers, IT professionals, and network administrators.
Prerequisites
- Basic knowledge of the Terminal application.
- Administrator privileges on your Mac.
1. Go to Utilities and select on Terminal.
2. Open the hostfile using command below:
sudo vim /etc/hosts
3. As you’re in the hosts file, insert your domain that you want to test. In this example, we choose malaysiahosting.com.my pointing to 118.107.202.163. After the changes has been done, save it.
4. Open the browser and go to the domain you like to preview.
Conclusion
You have successfully edited your Mac OS hosts file. These changes will immediately affect how your computer resolves domain names. If you encounter any issues or need to revert the changes, simply repeat the steps above and remove or comment out the entries.
For additional assistance or if you encounter any issues, please contact our support team at support@ipserverone.com.