macos – Vim Cant Save File (E212)

macos – Vim Cant Save File (E212)

This will ask you for the root password, then save your changes as you requested:

:w !sudo tee %

Then type (L)oad at the prompt, to re-load the file after it is saved.

Add this line to your .vimrc:

cmap w!! %!sudo tee > /dev/null

and then you can do

:w!!

when you get into this position, and it will write the file using sudo. Very handy.

macos – Vim Cant Save File (E212)

You can mkdir first, then save it.

Leave a Reply

Your email address will not be published.