Alright, looks like the issue is resolved by using some tips here and AI.
One issue was logging wasnt working and i was copying the script from windows which added some weird errors to JAMF.
Recopied and added the script through my macbook and it actually works.
For anyone interested, here is the final script used:
#!/bin/bash
# Logging setup
LOG="/Library/Logs/sophos_install.log"
log() { echo "$(date): $1" >> "$LOG"; }
# Create log file and set permissions
touch "$LOG"
chmod 666 "$LOG"
log "Starting Sophos installation"
log "Running as user: $(whoami)"
# Check for root
if [ "$(id -u)" != "0" ]; then
log "ERROR: Script must be run as root"
exit 1
fi
# Stop on any error
set -e
# Setup temp directory (macOS compatible mktemp)
SOPHOS_DIR=$(mktemp -d /tmp/Sophos_Install.XXXXXX)
trap 'log "Cleaning up temp directory..."; rm -rf ${SOPHOS_DIR}' EXIT
cd $SOPHOS_DIR
log "Working directory: $SOPHOS_DIR"
# Download installer
log "Downloading Sophos installer..."
curl -L -O "put intall link here"
# Unzip
log "Extracting installer..."
unzip SophosInstall.zip
log "Contents of temp dir: $(ls $SOPHOS_DIR)"
log "Extraction complete."
# Set permissions
log "Setting permissions..."
chmod a+x "$SOPHOS_DIR/Sophos Installer.app/Contents/MacOS/Sophos Installer"
chmod a+x "$SOPHOS_DIR/Sophos Installer.app/Contents/MacOS/tools/com.sophos.bootstrap.helper"
log "Permissions set."
# Run installer
log "Running Sophos installer..."
"$SOPHOS_DIR/Sophos Installer.app/Contents/MacOS/Sophos Installer" --quiet
log "Installer finished."
# Cleanup
log "Removing temp directory..."
rm -rf $SOPHOS_DIR
log "Sophos installation completed successfully"
exit 0
Thanks for all help and tips!