What exactly is a duplicate file?

When I wanted to edit the hosts file (/private/etc/hosts), it says:

You don't own the file "hosts" and don’t have permission to write to it.

You can duplicate this document and edit the duplicate. Only the duplicate will include your changes.

So, if I do my edits in the duplicate hosts file, is it equivalent to having my hosts file edited?

  • I've changed the title of this question to "What happens if I edit a duplicate Hosts file?" which might bring future Googlers to it more easily. Please feel free to edit further, or revert my change if you are not happy with it. – Tetsujin Oct 5 '15 at 13:16
  • 1
    @Tetsujin Looks appropriate. Thank you for making the change. – Dawny33 Oct 5 '15 at 13:18

This is a poorly chosen vocabulary since in a MacOS X file system a duplicate is a serious error meaning that the file-system is deeply corrupted.

The correct term which should have been used here is the term of copy.

If you don't have permission to edit /private/etc/hosts then make a local copy as follows:

cp /private/etc/hosts ~/hosts

If you really need to edit the /private/etc/hosts, I advise you to make first a backup local copy as above. And once you have edited and thoroughly verified it, put it back into place with sudo to get the admin priviledges:

/usr/bin/sudo cp ~/hosts /private/etc/hosts
| improve this answer | |

The Hosts file is not owned by any user, it is owned by System (root). The standard way to edit it is to drag a copy to the desktop, edit that, then drag it back & authenticate. Then you need to change the owner back to root.

To avoid all this fiddling around, you could use GasMask (freeware), which allows you to edit, copy [duplicate] & keep multiple hosts files, instantly switchable.

| improve this answer | |

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .