I am trying to run this script with no success to install on MACOS a PWA app for Microsoft Edge. The final use is for Intune to push PWA apps to end macos users on company.
Objective is that this PWA appears on MS Edge as an installed app and execute as such (an PWA app). I added some extras, as create dock shortcut, install brew if not exists and logs.
Problem: This script does not achieve to install a PWA on MS Edge, I have been searching a lot and not found info on installing PWA somehow to endusers on a company using intune.
Please see examples below of what this script is acheaving and a real installed PWA app.
Properly installed:

This script (opening tab as new tab):

Extras on my script:
- Dockutil to make shortcut
- Homebrew if dockutil is not installed
- Log to intune default folder
- Yummly as url to install PWA (no relation to that business, just an example)
The script:
`#!/bin/bash
Define variables
PWA_URL="https://www.yummly.com"
EDGE_PATH="/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge"
INSTALL_BASE_DIR="/Users/$USER/Applications/Edge Apps.localized"
LOG_DIR="/var/log"
LOG_FILE="$LOG_DIR/pwa_installation.log"
Function to get the PWA app name from the Edge window title
get_app_name() {
osascript <<EOF
tell application "Microsoft Edge"
activate
set windowTitle to name of front window
end tell
return windowTitle
EOF
}
Start logging
echo "Iniciando el script de instalación..." | tee -a "$LOG_FILE"
Check if Microsoft Edge is installed
if [ ! -f "$EDGE_PATH" ]; then
echo "Error: Microsoft Edge no está instalado en $EDGE_PATH." | tee -a "$LOG_FILE"
exit 1
fi
Create the installation directory if it does not exist
mkdir -p "$INSTALL_BASE_DIR"
Open the PWA URL in Edge
echo "Abriendo el PWA en Microsoft Edge..." | tee -a "$LOG_FILE"
"$EDGE_PATH" --app="$PWA_URL" --no-first-run --no-default-browser-check
Wait for a bit to allow Edge to open and load the PWA
sleep 20
Get the app name from Edge window title
APP_NAME=$(get_app_name)
if [ -z "$APP_NAME" ]; then
echo "Error: No se pudo obtener el nombre de la aplicación." | tee -a "$LOG_FILE"
exit 1
fi
echo "Nombre de la aplicación obtenido: $APP_NAME" | tee -a "$LOG_FILE"
Wait to allow PWA installation to complete
echo "Esperando a que se complete la instalación de la PWA..." | tee -a "$LOG_FILE"
sleep 60
Log the content of the installation directory
echo "Contenido del directorio de instalación:" | tee -a "$LOG_FILE"
ls -la "$INSTALL_BASE_DIR" | tee -a "$LOG_FILE"
Determine the location of the installed .app
APP_PATH=$(find "$INSTALL_BASE_DIR" -name "$APP_NAME.app" -print -quit)
Check if the PWA was installed successfully
if [ -z "$APP_PATH" ]; then
echo "Error: La instalación de la PWA falló o $APP_NAME no se encontró en $INSTALL_BASE_DIR." | tee -a "$LOG_FILE"
exit 1
else
echo "$APP_NAME se instaló correctamente en $APP_PATH." | tee -a "$LOG_FILE"
fi
Check if Homebrew is installed
if ! command -v brew &> /dev/null; then
echo "Homebrew no está instalado. Intentando instalar Homebrew..." | tee -a "$LOG_FILE"
# Install Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Verify Homebrew installation
if ! command -v brew &> /dev/null; then
echo "Error: No se pudo instalar Homebrew." | tee -a "$LOG_FILE"
exit 1
else
echo "Homebrew se instaló correctamente." | tee -a "$LOG_FILE"
fi
else
echo "Homebrew ya está instalado." | tee -a "$LOG_FILE"
fi
Check if dockutil is installed
if ! command -v dockutil &> /dev/null; then
echo "dockutil no está instalado. Intentando instalar dockutil..." | tee -a "$LOG_FILE"
# Install dockutil using Homebrew
brew install dockutil
if [ $? -ne 0 ]; then
echo "Error: No se pudo instalar dockutil." | tee -a "$LOG_FILE"
exit 1
else
echo "dockutil se instaló correctamente." | tee -a "$LOG_FILE"
fi
else
echo "dockutil ya está instalado." | tee -a "$LOG_FILE"
fi
Add the application to the Dock if it's not already present
if ! dockutil --find "$APP_PATH" &> /dev/null; then
echo "Añadiendo $APP_NAME al Dock..." | tee -a "$LOG_FILE"
dockutil --add "$APP_PATH" --no-restart
killall Dock
else
echo "$APP_NAME ya está en el Dock." | tee -a "$LOG_FILE"
fi
echo "Instalación completada." | tee -a "$LOG_FILE"`
I am trying to run this script with no success to install on MACOS a PWA app for Microsoft Edge. The final use is for Intune to push PWA apps to end macos users on company.
Objective is that this PWA appears on MS Edge as an installed app and execute as such (an PWA app). I added some extras, as create dock shortcut, install brew if not exists and logs.
Problem: This script does not achieve to install a PWA on MS Edge, I have been searching a lot and not found info on installing PWA somehow to endusers on a company using intune.
Please see examples below of what this script is acheaving and a real installed PWA app.
Properly installed:

This script (opening tab as new tab):

Extras on my script:
The script:
`#!/bin/bash
Define variables
PWA_URL="https://www.yummly.com"
EDGE_PATH="/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge"
INSTALL_BASE_DIR="/Users/$USER/Applications/Edge Apps.localized"
LOG_DIR="/var/log"
LOG_FILE="$LOG_DIR/pwa_installation.log"
Function to get the PWA app name from the Edge window title
get_app_name() {
osascript <<EOF
tell application "Microsoft Edge"
activate
set windowTitle to name of front window
end tell
return windowTitle
EOF
}
Start logging
echo "Iniciando el script de instalación..." | tee -a "$LOG_FILE"
Check if Microsoft Edge is installed
if [ ! -f "$EDGE_PATH" ]; then
echo "Error: Microsoft Edge no está instalado en $EDGE_PATH." | tee -a "$LOG_FILE"
exit 1
fi
Create the installation directory if it does not exist
mkdir -p "$INSTALL_BASE_DIR"
Open the PWA URL in Edge
echo "Abriendo el PWA en Microsoft Edge..." | tee -a "$LOG_FILE"
"$EDGE_PATH" --app="$PWA_URL" --no-first-run --no-default-browser-check
Wait for a bit to allow Edge to open and load the PWA
sleep 20
Get the app name from Edge window title
APP_NAME=$(get_app_name)
if [ -z "$APP_NAME" ]; then
echo "Error: No se pudo obtener el nombre de la aplicación." | tee -a "$LOG_FILE"
exit 1
fi
echo "Nombre de la aplicación obtenido: $APP_NAME" | tee -a "$LOG_FILE"
Wait to allow PWA installation to complete
echo "Esperando a que se complete la instalación de la PWA..." | tee -a "$LOG_FILE"
sleep 60
Log the content of the installation directory
echo "Contenido del directorio de instalación:" | tee -a "$LOG_FILE"
ls -la "$INSTALL_BASE_DIR" | tee -a "$LOG_FILE"
Determine the location of the installed .app
APP_PATH=$(find "$INSTALL_BASE_DIR" -name "$APP_NAME.app" -print -quit)
Check if the PWA was installed successfully
if [ -z "$APP_PATH" ]; then
echo "Error: La instalación de la PWA falló o $APP_NAME no se encontró en $INSTALL_BASE_DIR." | tee -a "$LOG_FILE"
exit 1
else
echo "$APP_NAME se instaló correctamente en $APP_PATH." | tee -a "$LOG_FILE"
fi
Check if Homebrew is installed
if ! command -v brew &> /dev/null; then
echo "Homebrew no está instalado. Intentando instalar Homebrew..." | tee -a "$LOG_FILE"
else
echo "Homebrew ya está instalado." | tee -a "$LOG_FILE"
fi
Check if dockutil is installed
if ! command -v dockutil &> /dev/null; then
echo "dockutil no está instalado. Intentando instalar dockutil..." | tee -a "$LOG_FILE"
else
echo "dockutil ya está instalado." | tee -a "$LOG_FILE"
fi
Add the application to the Dock if it's not already present
if ! dockutil --find "$APP_PATH" &> /dev/null; then
echo "Añadiendo $APP_NAME al Dock..." | tee -a "$LOG_FILE"
dockutil --add "$APP_PATH" --no-restart
killall Dock
else
echo "$APP_NAME ya está en el Dock." | tee -a "$LOG_FILE"
fi
echo "Instalación completada." | tee -a "$LOG_FILE"`