I am trying to add a line to my /etc/hosts
file but when I go to save it, I get the error "Cannot open file for writing: Permission denied".
The permissions for the file (ls -la /etc/hosts
) is as follows:
-rw-r--r-- 1 root wheel 289 Apr 22 2021 /etc/hosts
I've been searching the internet but still can't find my answer. I am running macOS Ventura. How can I edit this file?
ls -la /etc/hosts
produce?-rw-r--r-- 1 root wheel 289 Apr 22 2021 /etc/hosts
This is what I got!sudo
. For example, if using the nano editor:sudo nano /etc/hosts
. Enter your password and you'll be able to edit.