What is a Mac Hosts File? The hosts file is a text file that is comprised of a list of host names and their corresponding IP addresses. It basically serves as a database of domain names which your operating system employs to identify and locate hosts on an IP network. Mac Hosts File Location. Since editing the hosts file is a risky task, Apple has intentionally placed it in a private folder on your system. That’s to prevent users from modifying it without proper knowledge and causing damage to the entire system. The Mac hosts file is an important text document on Mac OS X that allows the mapping of hostnames to specified IP address. Even though the Internet has both public and private DNS servers for mapping of IP address, the hosts file on Mac is a good way to override DNS servers.
Hosts File Mac Terminal
The hosts file is used to map hostnames (in other words domains) to IP addresses. With the hosts file, you can change the IP address that you resolve a given domain name to. This change only affects your own computer without affecting how the domain is resolved worldwide. Another way for editing hosts file on Mac is via apart from using Mac terminal text editor is TextEdit. Navigate to Finder Go Go to Folder Now type /private/etc/hosts and tap on Go. Copy the hosts file on your Mac’s desktop and then double click the file to make changes.
Update Hosts File Mac
Back in November (2016) we wrote an article on how to edit your hosts file on your Windows computer. In that article we covered a few things such as what a hosts file is and why you should make changes to your computer’s hosts file.
For those of you who haven’t read that article, a hosts file is a file on your computer that allows you to map hostsnames to IP addresses. In simpler terms, it can give you the capability to test a website on a new IP before updating the DNS on that domain. For example, we use this process and prefer it over temporary URLs here at PeoplesHost for testing purposes when migrating new customers over to our environments. This allows us to test the website after it has been migrated to make sure there are no errors and the website is displaying properly.
HOW TO CHANGE THE HOSTS FILE ON A MAC COMPUTER
Changing the hosts file on a MAC computer is a fairly straightforward process for anyone that has used Terminal (or any other similar command line application or tool). If you haven’t used Terminal before this process will be new to you, but don’t be afraid because this tutorial is beginner friendly.
Follow these steps to edit your hosts file:
- Open Terminal by pressing CTRL + Spacebar or open the Spotlight search and search for “Terminal“
- Press the Enter key on your keyboard to open Terminal
- Type sudo nano /etc/hosts
- Type in the Password to your computer (it won’t show the text in Terminal, but the text is actually being entered). Once you have typed your Password press the Enter key
- Press the DOWN arrow key to get to the bottom of the hosts file
- Add your Shared IP along with your domain to the hosts file
- Hold the CONTROL button and press the letter O (CTRL + O) and press ENTER
- Hold the CONTROL button on your keyboard and press the letter X (CTRL + X)
Hosts File Mac Location
If you have any questions about this process don’t hesitate to reach out to support.
Mac Host File Path
Looking for reliable Windows or Linux hosting with Award Winning Customer Support?
Grab your hosting today with a 20% discount. All plans come with our 60 Money Back Guarantee!