On my main account on my main Mac, the open
command is not functioning only for the sub directories under ~/Documents/
. Namely, open ~/Documents/test
does not open that directory in Finder.app, but instead ~/
is shown in Finder.
I have been using the command for many years but I have never seen this issue.
What I tried are
- Removing the
~/Documents
directory but the new~/Documents
which macOS automatically creates has the same issue. - Tried another account and found that it worked. So the problem happens for the main user only.
- Rebooting does not help.
- Relaunching Finder does not help.
- Changing the shell to
bash
ortcsh
does not help. (I usually usezsh
.) - Opening other sub directories in
~/Library
or~/Music
works perfect. - Checking/unchecking "Terminal.app" in System Preferences > Security & Privacy > Privacy Full Disk Access (update 1)
Cmd + Shift + G
in Finder cannot change the location to any subdirectories in~/Documents
. (update 2)
In addition, probably the same (unknown) reason causes another issue.
Any application dialogs like "Open" or "Save" cannot accept drag & drop for sub directories under ~/Documents
. Namely, if I want to save a text file from TextEdit and drag & drop ~/Documents/test
in the save dialog, this location is not selected but instead ~/
is shown.
Does anyone have a nice idea to resolve or debug this issue?
(update 3)
Probably due to the facts that I forced to remove ~/Documents
by using sudo
and that Finder recreated a new directory, the xattr of ~/Documents
looks to be not properly set. How do I restore the settings? (XXX
is my user name)
$ ls -led Library Music Desktop Movies Documents
drwx------@ 451 XXX staff 14432 Jul 20 19:36 Desktop
0: group:everyone deny delete
drwxr-xr-x 2 XXX staff 64 Jul 23 11:09 Documents
drwx------@ 132 XXX staff 4224 May 8 14:52 Library
0: group:everyone deny delete
drwx------+ 31 XXX staff 992 Feb 26 2020 Movies
0: group:everyone deny delete
drwx------+ 8 XXX staff 256 Mar 14 2020 Music
0: group:everyone deny delete
The new directory contains GarageBand
, iMovie
, Keynote
, ... TextEdit
that are graphically shown in Finder, but they do not exist when executing ls
in Terminal.
$ ls -a Documents
. ..
~/Desktop/GarageBand
is a link(?) to /Users/XXX/Library/Containers/com.apple.garageband10/Data
.
(update 4)
I found that
$ open ~/Documents/test
was not functioning (i.e., ~
is shown in Finder), but
$ sudo mv ~/Documents ~/Documents_org
$ open ~/Documents_org/test
did work.
So the issue looks to be caused by the special directory settings of macOS (12.4) and my broken ~/Documents
.
(update 5)
- My main account
$ mdls Documents
kMDItemContentType = ""
kMDItemFSContentChangeDate = (null)
kMDItemFSCreationDate = (null)
kMDItemFSCreatorCode = ""
kMDItemFSFinderFlags = (null)
kMDItemFSHasCustomIcon = (null)
kMDItemFSInvisible = 0
kMDItemFSIsExtensionHidden = (null)
kMDItemFSIsStationery = (null)
kMDItemFSLabel = (null)
kMDItemFSName = (null)
kMDItemFSNodeCount = (null)
kMDItemFSOwnerGroupID = (null)
kMDItemFSOwnerUserID = (null)
kMDItemFSSize = (null)
kMDItemFSTypeCode = ""
kMDItemInterestingDate_Ranking = 2022-07-23 00:00:00 +0000
kMDItemLastUsedDate = 2022-07-23 03:01:10 +0000
kMDItemLastUsedDate_Ranking = 2022-07-23 00:00:00 +0000
kMDItemUseCount = 2
kMDItemUsedDates = (
"2022-07-22 15:00:00 +0000"
)
- Another account
% mdls Documents
_kMDItemDisplayNameWithExtensions = "Documents"
kMDItemAlternateNames = (
Documents
)
kMDItemContentCreationDate = 1970-01-01 00:00:00 +0000
kMDItemContentCreationDate_Ranking =
kMDItemContentModificationDate = 2021-04-12 07:57:09 +0000
kMDItemContentModificationDate_Ranking = 2021-04-12 00:00:00 +0000
kMDItemContentType = "public.folder"
kMDItemContentTypeTree = (
"public.folder",
"public.directory",
"public.item"
)
kMDItemDateAdded = 2021-03-31 16:24:18 +0000
kMDItemDateAdded_Ranking = 2021-03-31 00:00:00 +0000
kMDItemDisplayName = "Documents"
kMDItemDocumentIdentifier = 0
kMDItemFSContentChangeDate = 2021-04-12 07:57:09 +0000
kMDItemFSCreationDate = 1970-01-01 00:00:00 +0000
kMDItemFSCreatorCode = ""
kMDItemFSFinderFlags = 0
kMDItemFSHasCustomIcon = (null)
kMDItemFSInvisible = 0
kMDItemFSIsExtensionHidden = 0
kMDItemFSIsStationery = (null)
kMDItemFSLabel = 0
kMDItemFSName = "Documents"
kMDItemFSNodeCount = 1
kMDItemFSOwnerGroupID = 20
kMDItemFSOwnerUserID = 502
kMDItemFSSize = (null)
kMDItemFSTypeCode = ""
kMDItemInterestingDate_Ranking = 2021-04-12 00:00:00 +0000
kMDItemKind = "Folder"