def install_app(
        device: Device,
        app_path: _Path,
    ) -> _AppInstallationInfo:
        """
        Install an application on the specified device.

        This method attempts to install an application on the given device using the
        'xcrun devicectl' command-line tool. It parses the installation result and
        returns information about the installed application.

        Parameters
        ----------
        device: Device
            The target device on which to install the application.

        app_path: Path
            The path to the application file (.ipa or .app) to be installed. This should
            be a Path object pointing to a valid application file.

        Returns
        -------
        AppInstallationInfo
            If successful, returns an AppInstallationInfo object containing:
            - bundle_identifier: The bundle ID of the installed application.
            - database_uuid: The database UUID assigned to the installed application.

        """
        json_data = _DeviceCtl._run_command(
            f"xcrun devicectl device install app -d {device.identifier} {app_path.resolve()}"
        )
        result = json_data.get("result", None)

        if result is None:
            raise _DeviceCtlError("App installation failed: No result data returned")

        installed_applications = result.get("installedApplications", [])
        if not isinstance(installed_applications, _Sequence):
            raise _DeviceCtlError("App installation failed: Invalid installed applications data")

        installed_application = next(iter(installed_applications), None)
        if not isinstance(installed_application, _Mapping):
            raise _DeviceCtlError("App installation failed: No applications were installed")

        bundle_identifier = installed_application.get("bundleID", "")
        database_uuid = installed_application.get("databaseUUID", "")

        return _AppInstallationInfo(
            bundle_identifier=bundle_identifier,
            database_uuid=database_uuid,
        )

        Install an application on the specified device.

        This method attempts to install an application on the given device using the
        'xcrun devicectl' command-line tool. It parses the installation result and
        returns information about the installed application.

        Parameters
        ----------
        device: Device
            The target device on which to install the application.

        app_path: Path
            The path to the application file (.ipa or .app) to be installed. This should
            be a Path object pointing to a valid application file.

        Returns
        -------
        AppInstallationInfo
            If successful, returns an AppInstallationInfo object containing:
            - bundle_identifier: The bundle ID of the installed application.
            - database_uuid: The database UUID assigned to the installed application.

        
coremltools/models/ml_program/experimental/remote_device.py