Menu Close

How to edit Mac OS hosts file?

techwetrust post image

What is the path of hosts file in Mac OS?

/private/etc/hosts

How to open for editing the hosts file in Mac OS?

Using nano:

sudo nano /private/etc/hosts

Using vim:

sudo vim /private/etc/hosts

How to edit the hosts file?

You can modify your hosts file in order to change the domain name system (DNS) for a domain on your computer.

What does this mean? You can make simple aliases point to your services. For example, I’m using my hosts file to resolve my local services.

127.0.0.1       mongodb
127.0.0.1       redis

Useful links

https://en.wikipedia.org/wiki/Hosts_(file)

Spread the love

Leave a Reply