Tutorial

New updates and improvements to Roundfleet.

Important notice

The code examples and scripts provided in these tutorials are for educational purposes only. Roundfleet is not responsible for any issues, damages, or security vulnerabilities that may arise from the use, modification, or implementation of these examples. Always review and test code in a secure environment before using it in production systems.

Get Application Path on macOS

Learn how to find and retrieve application installation paths on Mac devices using scripts. This is essential for application management, script deployment, and allowlist/blocklist configuration.

Basic App Path Finder

Find the path of an application using its bundle identifier:

#!/bin/bash

# Specify the bundle ID
BUNDLE_ID="com.apple.Safari"

# Find app path using mdfind
APP_PATH=$(mdfind "kMDItemCFBundleIdentifier=='${BUNDLE_ID}'")

if [[ -n "$APP_PATH" ]]; then
    echo "Application path: $APP_PATH"
else
    echo "Application not found: $BUNDLE_ID"
fi

Enhanced Path Discovery

Script with validation and multiple search methods:

#!/bin/bash

# Function to find app path
find_app_path() {
    local bundle_id="$1"
    
    # Method 1: Use mdfind with bundle identifier
    local app_path=$(mdfind "kMDItemCFBundleIdentifier=='${bundle_id}'" | head -1)
    
    if [[ -n "$app_path" && -d "$app_path" ]]; then
        echo "$app_path"
        return 0
    fi
    
    # Method 2: Search common directories
    local common_paths=(
        "/Applications"
        "/System/Applications"
        "/Applications/Utilities"
        "/System/Library/CoreServices"
    )
    
    for path in "${common_paths[@]}"; do
        if [[ -d "$path" ]]; then
            local found=$(find "$path" -name "*.app" -maxdepth 2 -exec defaults read {}/Contents/Info.plist CFBundleIdentifier \; -print 2>/dev/null | grep -B1 "^${bundle_id}$" | grep "\.app$")
            if [[ -n "$found" ]]; then
                echo "$found"
                return 0
            fi
        fi
    done
    
    return 1
}

# Example usage
BUNDLE_ID="${1:-com.apple.Safari}"

echo "Searching for application: $BUNDLE_ID"

if APP_PATH=$(find_app_path "$BUNDLE_ID"); then
    echo "Found application at: $APP_PATH"
    
    # Get additional info
    APP_NAME=$(defaults read "$APP_PATH/Contents/Info.plist" CFBundleName 2>/dev/null)
    APP_VERSION=$(defaults read "$APP_PATH/Contents/Info.plist" CFBundleShortVersionString 2>/dev/null)
    
    echo "Application Name: ${APP_NAME:-Unknown}"
    echo "Version: ${APP_VERSION:-Unknown}"
else
    echo "Application not found: $BUNDLE_ID"
    exit 1
fi

Multiple App Path Finder

Find paths for multiple applications at once:

#!/bin/bash

# Array of bundle IDs to search for
BUNDLE_IDS=(
    "com.apple.Safari"
    "com.apple.finder"
    "com.apple.systempreferences"
    "com.microsoft.Excel"
    "com.adobe.Photoshop"
)

# Function to find app path
find_app_path() {
    local bundle_id="$1"
    mdfind "kMDItemCFBundleIdentifier=='${bundle_id}'" | head -1
}

echo "=== Application Path Report ==="
echo "Generated: $(date)"
echo "Device: $(hostname)"
echo "================================"

for bundle_id in "${BUNDLE_IDS[@]}"; do
    echo "Searching: $bundle_id"
    
    app_path=$(find_app_path "$bundle_id")
    
    if [[ -n "$app_path" && -d "$app_path" ]]; then
        echo "  ✓ Found: $app_path"
        
        # Get app version if available
        version=$(defaults read "$app_path/Contents/Info.plist" CFBundleShortVersionString 2>/dev/null)
        if [[ -n "$version" ]]; then
            echo "  📦 Version: $version"
        fi
    else
        echo "  ✗ Not found"
    fi
    echo
done

Bundle ID Discovery

Find bundle IDs of installed applications:

#!/bin/bash

echo "=== Installed Applications Bundle IDs ==="

# Search in common application directories
SEARCH_PATHS=(
    "/Applications"
    "/System/Applications"
    "/Applications/Utilities"
)

for search_path in "${SEARCH_PATHS[@]}"; do
    if [[ -d "$search_path" ]]; then
        echo "Scanning: $search_path"
        
        find "$search_path" -name "*.app" -maxdepth 2 | while read app_path; do
            app_name=$(basename "$app_path" .app)
            bundle_id=$(defaults read "$app_path/Contents/Info.plist" CFBundleIdentifier 2>/dev/null)
            
            if [[ -n "$bundle_id" ]]; then
                echo "  $app_name -> $bundle_id"
            fi
        done
        echo
    fi
done

Usage with Roundfleet

  1. Modify the BUNDLE_ID variable with your target application
  2. For multiple apps, update the BUNDLE_IDS array
  3. Deploy through Roundfleet's remote script execution
  4. View results in the action history

Common Bundle IDs

ApplicationBundle ID
Safaricom.apple.Safari
Findercom.apple.finder
System Preferencescom.apple.systempreferences
Microsoft Wordcom.microsoft.Word
Google Chromecom.google.Chrome
Firefoxorg.mozilla.firefox
Slackcom.tinyspeck.slackmacgap
Zoomus.zoom.xos

Troubleshooting

No results found: Verify the bundle ID is correct and application is installed Multiple paths returned: Use head -1 to get the first result or filter by specific location Permission denied: Ensure script has necessary file system access permissions


Note: Bundle IDs are case-sensitive. Use the exact format as provided by the application developer.

Related Tutorials

Safari Browser Management on macOS

Learn how to configure Safari homepage, browser settings, security policies, and deploy enterprise browser management across your Roundfleet devices with comprehensive user management and compliance features.

Jul 7, 2025

Rosetta 2 and Apple Silicon Compatibility Management on macOS

Learn how to install, manage, and monitor Rosetta 2 translation layer on Apple Silicon Macs with enterprise-grade compatibility management, application monitoring, and fleet-wide deployment capabilities.

Jul 7, 2025

Package Management with Homebrew on macOS

Deploy, manage, and maintain software packages across macOS devices using Homebrew with enterprise-grade configuration management, compliance tracking, and automated deployment workflows.

Jul 7, 2025

Manage Kernel Extensions on macOS

Learn how to display, load, unload, and monitor kernel extensions (kexts) on macOS devices using command-line scripts for enhanced system management and security.

Jul 7, 2025

Install Unsigned Packages on macOS

Deploy and install unsigned PKG packages on Mac devices using scripts for specialized development tools and open-source software.

Jul 7, 2025

Install Latest Firefox Version on macOS Devices

Learn how to install and manage the latest Firefox version on macOS devices for enterprise deployment, updates, and configuration management.

Jul 7, 2025

App Store Inventory Management on macOS

Learn how to discover, track, and manage App Store applications on macOS devices using comprehensive inventory scripts with enterprise reporting, compliance tracking, and fleet-wide app management capabilities.

Jul 7, 2025

App Store Auto Updates Management on macOS

Learn how to control App Store automatic updates on macOS devices using command-line tools. Comprehensive guide for enterprise update management, bandwidth optimization, and security control.

Jul 7, 2025