How can I remove a hard link to my home directory in a subdirectory?

I'm not sure how this happened, but I've got a hard link to my home directory in a subdirectory of my home directory. This is not healthy - it's hard coded to be avoided in the Linux kernel. I've confirmed that the hard link is there:


MacBookPro:prune tim$ stat ~

16777220 1036638 drwxr-xr-x 213 tim staff 0 6816 "Sep 7 22:17:12 2025" "Sep 7 22:17:12 2025" "Sep 7 22:17:12 2025" "Sep 6 15:27:40 2018" 4096 0 0 /Users/tim

MacBookPro:prune tim$ pwd

/Users/tim/Projects/prune


I don't know what happened to cause this, but I'd like to remove it


`rm` doesn't work.


pwd

/Users/tim/Projects/prune

MacBookPro:prune tim$ rm ~

rm: /Users/tim: is a directory



MacBook Pro 15″, macOS 10.15

Posted on Sep 7, 2025 2:38 PM

Reply
5 replies

Sep 8, 2025 6:48 AM in response to mtimc

mtimc wrote:

The good news is that I removed the hard link with `Finder`, although I'd like to understand what it did as using a GUI is hardly a repeatable process.

The code above should show that in the directory `/Users/tim/Projects/prune` there is a subdirectory `~` that `stat` shows has the same inet node as `/Users/tim`

To clarify. The ~ path is a built-in shell shortcut to your home directory. So if you start talking about trying to delete it, people are going to simply think you're confused and about to delete all of your files. A screenshot would have cleared up the misunderstanding.


It's possible that some misconfigured script or app created the /Users/tim/Projects/prune/~ object, assuming that it really existed. If so, then the Finder would be the appropriate method to remove it.


I don't know how I managed to create this.

Maybe you should review whatever the "prune" project is doing.

Sep 7, 2025 2:56 PM in response to mtimc

mtimc wrote:

I'm not sure how this happened, but I've got a hard link to my home directory in a subdirectory of my home directory. This is not healthy - it's hard coded to be avoided in the Linux kernel. I've confirmed that the hard link is there:

MacBookPro:prune tim$ stat ~
16777220 1036638 drwxr-xr-x 213 tim staff 0 6816 "Sep 7 22:17:12 2025" "Sep 7 22:17:12 2025" "Sep 7 22:17:12 2025" "Sep 6 15:27:40 2018" 4096 0 0 /Users/tim
MacBookPro:prune tim$ pwd
/Users/tim/Projects/prune

I don't know what happened to cause this, but I'd like to remove it

`rm` doesn't work.

pwd
/Users/tim/Projects/prune
MacBookPro:prune tim$ rm ~
rm: /Users/tim: is a directory



not sure I get it...?


copy and paste:

cd 

Sep 8, 2025 4:54 AM in response to leroydouglas

The good news is that I removed the hard link with `Finder`, although I'd like to understand what it did as using a GUI is hardly a repeatable process.


The code above should show that in the directory `/Users/tim/Projects/prune` there is a subdirectory `~` that `stat` shows has the same inet node as `/Users/tim`


I don't know how I managed to create this.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

How can I remove a hard link to my home directory in a subdirectory?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.