How do you open a specific folder in Finder without applescript?
Background
I've replaced Finder as the default folder-opening app by editing ~/Library/Preferences/com.apple.LaunchServices/com.apple.launchservices.secure.plist
:
<snip>
{
LSHandlerContentType = "public.folder";
LSHandlerPreferredVersions = {
LSHandlerRoleAll = "-";
};
LSHandlerRoleAll = "org.yanex.marta";
},
<snip>
So now when I type open .
or similar in the terminal, it opens the directory in Marta instead. That's good, I want that.
Issue
There's only one exception where I want to use Finder, and that's when opening the /Applications
folder, since Marta is unable to delete stuff from /Applications.
I know this can be done with applescript, but applescripts have a few seconds' delay before they run, which I'm hoping to eliminate by using bash instead.
The purpose of all this is to have a script which can be called from raycast.
So far I've tried:
/System/Library/CoreServices/Finder.app /Applications # requires sudo
open /System/Library/CoreServices/Finder.app --args /Applications # just opens Finder but doesn't open the folder
Testing in both macOS Catalina and macOS Big Sur, the following command in Terminal opens a Finder window to /Applications:
open -a Finder /Applications