#!/bin/bash set -euo pipefail # Build the app and create a proper macOS .app bundle # MenuBarExtra requires a bundled application to render in the menu bar. # Always run from project root SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" PROJECT_DIR="$(cd "${SCRIPT_DIR}/.." && pwd)" cd "${PROJECT_DIR}" APP_NAME="HomeManagerStatus" BUILD_DIR=".build/release" APP_BUNDLE="${APP_NAME}.app" CONTENTS_DIR="${APP_BUNDLE}/Contents" MACOS_DIR="${CONTENTS_DIR}/MacOS" echo "Building release binary..." swift build -c release echo "Creating app bundle..." rm -rf "${APP_BUNDLE}" mkdir -p "${MACOS_DIR}" # Copy the binary cp "${BUILD_DIR}/${APP_NAME}" "${MACOS_DIR}/${APP_NAME}" # Copy Info.plist cp "${PROJECT_DIR}/Info.plist" "${CONTENTS_DIR}/Info.plist" echo "Done! App bundle created at: ${APP_BUNDLE}" echo "" echo "To run: open ${APP_BUNDLE}" echo "To install: cp -r ${APP_BUNDLE} /Applications/"