Skip to content

Instantly share code, notes, and snippets.

@RhetTbull
Last active October 2, 2022 16:34
Show Gist options
  • Save RhetTbull/a528c6d99a161a2eabce8afb5c56c52a to your computer and use it in GitHub Desktop.
Save RhetTbull/a528c6d99a161a2eabce8afb5c56c52a to your computer and use it in GitHub Desktop.
Simple shell script to open the macOS Finder's "Info Window" for a file or folder from command line
#!/bin/bash
# Simple script to open the macOS Finder's "Info Window" for a file or folder.
# Usage: finfo [file or folder]
# This relies on realpath being installed (brew install coreutils)
if [ -z "$1" ]; then
echo "Usage: finfo [file or folder]"
exit 1
fi
fpath=$(/usr/local/bin/realpath $1) # Get the full path to the file
osascript \
-e "set aFile to (POSIX file \"$fpath\") as alias" \
-e "tell application \"Finder\" to open information window of aFile" \
-e "tell application \"Finder\" to activate"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment