How to trigger "Get Info" for file using command line?
Solution 1:
I don't think you can do this with a shell command, but you can use a shell script to run AppleScript, which can do it. See here:
https://stackoverflow.com/questions/24421803/open-info-window-in-finder-by-applescript
https://stackoverflow.com/questions/37231942/open-get-information-window-in-finder-by-applescript-again
For example:
osascript -e "set aFile to (POSIX file \"/Applications/Firefox.app\") as text" \
-e "tell application \"Finder\" to open information window of file aFile"
If you want to add in your bash or zsh profile:
getfileinfo() {
local FILE="$1"
if [[ -r "${FILE}" ]]; then
osascript <<EOF
set aFile to (POSIX file "$FILE") as alias
tell application "Finder" to open information window of aFile
EOF
fi
}