8

I do not use the folders ~/{Downloads, Documents, Public} and so I remove them. But some Mac OS X process keeps recreating them.

How can I disable the creation of these folders permanently? What process(es) are creating them?

Note: I do download files, e.g. from Safari, but they then go to a different directory. Safari allows this to be customized, so why can't the default directory be erased?

Note: I have run a crontab to delete these folders on a routine basis, however this is not a satisfactory solution especially since it needs to be run by root or an administrator.

3 Answers 3

5

It's definitively not recommended to remove these directories because a lot of applications just assume they are there. But it's your computer of course, so you can do with it whatever you like.

Instead of hunting down all applications/processes which might recreate these folders you could change their properties to make them invisible in Finder and inaccessible for everything :

chflags hidden ~/{Downloads,Documents,Public}
chmod 000 ~/{Downloads,Documents,Public}
2
  • 1
    This suggestion still leaves the files visible to "ls" when working from the command line in an X window. I'd like to actually remove the directories and keep them from coming back. I don't mind if the directories are created when something needs to go in them; but e.g. I don't want to have Public/ under ~/ all the time when I never use it.
    – edgeloss
    Aug 24, 2013 at 16:24
  • 2
    I've also been looking for a way to accomplish this. I ended up using chflags and chmod as described previously. To stop "ls" from listing these folders I use the --ignore option: ls --ignore 'Desktop', etc.
    – user56920
    Sep 21, 2013 at 18:30
2

I dislike Documents because (a) I don't use it, and (b) it gets in the way when I'm trying to get into Downloads with tab-completion in the shell window.

Taking into account what the other answer says about Apple being very opinionated about how you use the computer they're letting you give them money to use, and that things may break...

From Terminal, I removed everything inside the documents directory:

23:03 ~ % rm -rf Documents    
rm: Documents: Permission denied
23:03 ~ % ls -la Documents    
total 0
drwx------+   3 tim staff    96 31 Jul 23:03 .
drwxr-x---+ 272 tim staff  8704 31 Jul 23:02 ..

See the + on the end of drwx------? That means Apple has extra permissions hiding in there. You need the extra -e flag:

 -e      Print the Access Control List (ACL) associated with the file, if present, in long (-l)
         output.

So...

23:11 ~ % ls -lae Documents 
total 0
drwx------+   2 tim staff    64 31 Jul 23:03 .
 0: group:everyone deny delete
drwxr-x---+ 272 tim staff  8704 31 Jul 23:06 ..
 0: group:everyone deny delete

Turns out these ACLs are managed by chmod.

23:22 ~ % chmod -a "everyone deny delete" Documents
23:22 ~ % ls -lae Documents                         
total 0
drwx------    2 tim staff    64 31 Jul 23:03 .
drwxr-x---+ 272 tim staff  8704 31 Jul 23:21 ..
 0: group:everyone deny delete
23:23 ~ % rmdir Documents

Yay.

23:23 ~ % ls
AndroidStudioProjects
Applications
Desktop
Downloads

Allegedly, MacOs and/or other things that expect to see it there will recreate it, but at least it's gone for now.

2
  • Interesting, I just tried on macOS 13.6 but it almost immediately gets recreated. rmdir Documents && sleep 0.1 && ls Documents output: total 0
    – victorlin
    Nov 3, 2023 at 5:02
  • @victorlin I noticed that too, but in my case I did a variation of what you did - since I wanted to create a symbolic link to another location, i ran: rmdir Documents && ln -s /my/directory ~/ which instantly create a link and prevented the Documents directory from being recreated.
    – JW8
    Mar 18 at 22:26
-1

When you buy a certain thing, say, a Mac, you accept its parts to a large degree. We tweak and fiddle and adapt it to our wants, especially here - I'm just saying, there's a limit. Leave the folder structure alone, let OS X be OS X, especially in ways that don't really hamper your use of it at all.

You must log in to answer this question.

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