.local-bin/docs/get_app_id/Usage.md

1.5 KiB

get_app_id

Retrieves macOS application bundle identifiers.

Description

This script extracts the code-signing identifier (bundle ID) from macOS application bundles. Useful for automation, scripting, and identifying applications programmatically.

Platform

macOS only - Uses codesign command which is macOS-specific

Usage

./get_app_id.sh [app_name|app_path]

Arguments

  • app_name: Name of the app (e.g., "Safari" or "Safari.app")
  • app_path: Full path to the .app bundle (e.g., "/Applications/Safari.app")

Examples

# Interactive mode - select from all applications using fzf
./get_app_id.sh

# Get bundle ID by app name
./get_app_id.sh Safari

# Get bundle ID by full path
./get_app_id.sh /Applications/Safari.app

# Output: com.apple.Safari

Interactive Mode

When run without arguments, the script:

  1. Lists all applications in /Applications
  2. Opens an fzf picker with live preview showing the bundle ID
  3. Returns the selected app's identifier

Requirements

  • macOS with codesign command (included in Xcode Command Line Tools)
  • fzf (for interactive mode): brew install fzf

How It Works

The script extracts the identifier from the code signature using:

codesign -dr - "/Applications/AppName.app" | grep identifier

Notes

  • Apps must be code-signed to have a bundle identifier
  • Some apps may not have code signatures (returns error)
  • The interactive preview shows "No code signature found" for unsigned apps