emacs tells me directory is write-protected
8,664
Wait, you're trying to save a file into the root directory? Are you sure you actually want to do that?
If you're sure, save it as /sudo::/filename
instead. I don't know much about OSX, but as it's your own machine I'm assuming you have sudo permissions, in which case Emacs will prompt you for your password, and should then write the file.
Related videos on Youtube
Author by
benbyday
Updated on September 18, 2022Comments
-
benbyday over 1 year
I have come up with an issue when I tried to save a file. I managed to write the intended file but then when I try to save it with the command Ctrl + x, Ctrl + s the message comes up
Directory / write-protected
How can I save the file? -
Admin about 11 yearsWhen I try to do that I get the message "Operation not permitted, /../.file"
-
choroba about 11 yearsIf you do not have the permission to create a file in a directory and you cannot change it, Emacs cannot do anything about it. Ask your system administrator.
-
Admin about 11 yearsAlso, how can I get the directory of a file I haven't saved yet?
-
Admin about 11 yearsI am the system administrator. I'm just working on my laptop. How do I let emacs know that?
-
choroba about 11 years@user1765835: As a system admin, you should be permitted to change permissions on directories. What OS are you running? Do you use ACL's?
-
choroba about 11 years@user1765835: Emacs keeps a "current directory". If you do not specify otherwise, a new file is written to it.
-
Admin about 11 yearsI'm on a MacBook Pro, OS 10.7.5 so that's Lion. I don't think I use any ACL's
-
benbyday about 11 yearsThat's the weird thing! I'm not! It's possible I was before, but I changed the save location to a folder that is definitely fine to write in and emacs is still giving me strife.
-
phils about 11 yearsHow about
C-x C-w ~/filename RET
to save into your home directory. Does that work? -
yurisich over 9 yearsThis is so useful for jumping into
/etc/
without reverting to launching another session as sudo. Thanks!