I am now on OS X 10.9, and I am not sure whether this issue also occurs on other versions.
So, I have many symlinks in my file system (created by ln -s
). Today I modified one of them with ln -f -s
(see detailed steps below). The symlink is working without problem, but the icon of the symlink in Finder changed from folder icon (with alias badge) to file icon (with alias badge). Namely, the icon should be
(since the symlink is pointing to a folder) but it is now
The steps I took to modify the link were as follows (say I had the symlink ~/links/folder
linking to ~/folder
before, and I want to move ~/folder
to ~/renamed-folder
while updating the symlink to ~/links/renamed-folder
):
mv ~/links/folder ~/links/wrongly-renamed-folder
, the link is active but renamed (happen to be wrongly renamed in my specific case, revealed by my zsh history).mv ~/folder ~/renamed-folder
, here the link became dead. After this step the link icon should be a file icon (that is the default behavior when link is dead).mv ~/links/wrongly-renamed-folder ~/links/renamed-folder
, I corrected the wrong link name (I don't whether this contributed to the final behavior, so I record it here faithfully).ln -f -s ~/renamed-folder ~/renamed-folder
, the link is working again, and ideally the icon of the symlink should be back to a folder icon. But in my case the icon is still a file icon.
I took some measures to fix this problem but failed. The things I've tried:
Remove the link completely and reconstruct a new one with
ln -s
. No use. The icon is still a file icon. Strangely enough, if I create another link with the same destination (but a different name), the icon will be a folder icon as expected. Only that one single name (~/links/renamed-folder
in the above example) is "reserved."Try to paste the correct
icns
file into the Info panel. No use. And I didn't expect this to work actually, since Unix symlinks do not have their own associated icons, unlike OS X aliases.Relaunch finder, or even log out and log back in. I know this is dumb, but people do this when desperate. And it sometimes does work like a charm; but not this time, unfortunately.
Then I did an experiment that actually kind of revealed a bug in Finder. Steps:
ln -s ~/Downloads ~/tmp
. The icon oftmp
is the aliased download folder icon as expected.rm ~/tmp
.ln -s ~/other-folder ~/tmp
. The icon oftmp
, however, is still the aliased download folder icon, though the folder linked to is not the download folder anymore.
So there seems to be some kind of "cache" going on behind the scenes that controls the icons of symlinks, and Finder sometimes fails to update the cache when symlink is modified.
So, my question is, where is the "cache" that controls icons of symlinks? Thanks.