I have noticed rm -rf has a strange behavior in my macOS BigSur. I created a directory for a font installation:

~/code ❯ ls -la                                                         10:06:54
total 16
drwxr-xr-x  21 fredguth  staff   672 Oct 30 08:47 .
drwxr-xr-x+ 71 fredguth  staff  2272 Nov  5 10:07 ..
drwxr-xr-x   7 fredguth  staff   224 Nov  5 09:57 FontPro  <<<<======== This directory

I am user fredguth, the owner of the directory.

~/code ❯ whoami                                                  3m 34s 10:21:34

I am trying to rm -rf FontPro.

This happens:

rm: FontPro/tfm/MinionPro-MediumItCapt-osf-l1-ly1--lcdfj.tfm: Permission denied
rm: FontPro/tfm/MinionPro-BoldIt-lf-t2a--base.tfm: Permission denied
rm: FontPro/dvips/a_fzbwjk.enc: Permission denied
rm: FontPro/dvips: Directory not empty
rm: FontPro: Directory not empty

I don't get it. I use rm -rf for non-empty directories, and I don't want to use sudo if I don't strictly need to.

Is there any macOs setting preventing me from rm -rf, or am I missing something else?

  • 4
    Please add ls -ld FontPro/tfm to your question. I think it's likely this directory is missing write permissions Nov 5, 2021 at 13:27
  • have you closed the program using usually those subdirs? (on unix it shouldn't matter much, but on mac, there may be a security mechanism preventing removing a file while in use?) Nov 5, 2021 at 16:27
  • Have you performed a chmod -R 755 FontPro to set correct permissions on all files and directories contained in FontPro?
    – JG7
    Nov 5, 2021 at 16:30
  • you can also try: find ~/code/FontPro -ls | grep -v "fredguth staff" and see if some files belong to some other user. if not, find -type d ~/code/FontPro -ls | grep -v "^..w." will find those subdirs where you don't have, as the user, writing right (necessary to delete subdirs and files within that dir). And welcome to unix.se ! Nov 5, 2021 at 16:30
  • @roaima What a newbie mistake!
    – Fred Guth
    Nov 10, 2021 at 13:36

2 Answers 2


Newbie mistake. On comments suggestion:

~/code ❯ ls -ld FontPro/tfm
drwxr-xr-x  8156 root  staff  260992 Oct 26 21:26 FontPro/tfm

I just realized that there is this subdir that is owned by root. This is the culprit.

~/code ❯ sudo chown -R fredguth FontPro                             33s 10:33:20
~/code ❯ ls -ld FontPro/tfm                                             10:33:39
drwxr-xr-x  8156 fredguth  staff  260992 Oct 26 21:26 FontPro/tfm
~/code ❯ rm -rf FontPro                                                 10:33:44
~/code ❯ 

working now.

P.S. @JG7 and @roaima, if you post an answer I can mark yours as the right one.


I ran into a similar situation, but the folder was owned by me. Turns out I had a Docker for Mac container running that was using the folder as a bind mount. Stopping my containers allowed me to delete the folder.

> rm -rf The.Folder.In.Question/
rm: The.Folder.In.Question/: Permission denied
> docker ps
CONTAINER ID   IMAGE                           COMMAND                  CREATED          STATUS          PORTS                     NAMES
26072a9ee2d7   logtestmicroservice             "dotnet watch"           12 minutes ago   Up 12 minutes>8080/tcp   LogTestMicroService_container
bcf515e5792e   logtestmicroservice_generator   "dotnet watch -- run…"   13 minutes ago   Up 13 minutes>8080/tcp   LogTestMicroService_generator_container
> docker stop 26072a9ee2d7 bcf515e5792e
> rm -rf The.Folder.In.Question/ && echo good
  • 1
    This was not the root cause and should be considered an edge case, especially since not everyone runs Docker, but it is still a decent answer for someone who finds themselves in your particular situation. Apr 20, 2022 at 17:02

You must log in to answer this question.

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