For work reasons I kept some sites blocked in /etc/hosts but I need now to make them available again.

For this, I tried to open /etc/hosts file but to my surprise the editors (Vi or Nano) opened another one located on the path /private/etc/hosts.

How could be the original configuration file opened?

  • I can not recreate your issue in High Sierra or Monterey. Which version of macOS are you using? Are you booted to Recovery mode? Jul 7, 2022 at 21:26
  • Hi, sorry for the late reply. I use BigSur version 11.4. It was not recovery mode when I had discovered the issue.
    – Demokritus
    Jul 25, 2022 at 18:37

2 Answers 2


As you can see using utilities like stat, file, or ls, /etc is a symbolic link to /private/etc:

stat -F /etc
#=> lrwxr-xr-x 1 root wheel 11 May  9 23:30:48 2022 /etc@ -> private/etc

file -h /etc
#=> /etc: symbolic link to private/etc

ls -Fl1 /etc
#=> /etc@
  • 1
    There is also ls -ld /etc. Jul 7, 2022 at 21:11
  • Thanks for the explanation. To me as a linux user it was unknown fact.
    – Demokritus
    Jul 25, 2022 at 18:38

You can confirm that /private/etc/hosts and /etc/hosts are two separate file system entries for the same inode with ls -i:

% ls -i /etc/hosts /private/etc/hosts
1278801 /etc/hosts         1278801 /private/etc/hosts

It doesn't really matter why the inodes are the same; what matters is that you are editing the same file regardless of which name you use.

  • Doesn't work. What if they're on two filesystems?
    – Joshua
    Jul 8, 2022 at 16:00
  • 2
    Then the OP will know that they need to figure out which file is the correct one to edit. (But then it would also be extremely surprising if <cmd> /etc/hosts opened the other one instead.)
    – chepner
    Jul 8, 2022 at 16:01

You must log in to answer this question.

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