Stop SSHFS hanging, and name the real reason Gatekeeper refuses an app

With macFUSE's FSKit extension off, sshfs waits forever and ignores TERM;
sftp_mount gives it 30 seconds, then stops it and says to turn macFUSE on.

On a Mac that allows only App Store apps, app_install said the download
"isn't notarized"; it now says the Mac only allows App Store apps, and where
to change that.

The vanilla image is like that and since macOS 15 only System Settings or
MDM can change it, so 70-apps checks the message and skips the installs
there. 85-sftp checks that add_sftp gives up while the extension is off.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
David Young
2026-11-11 15:01:03 -07:00
co-authored by Claude Opus 5.5
parent f2e6908dfd
commit eab26c0888
5 changed files with 74 additions and 11 deletions
+20 -2
View File
@@ -97,12 +97,30 @@ verify_team() {
fi
}
# Whether Gatekeeper allows apps from identified developers, and not only
# the App Store (System Settings > Privacy & Security)
developer_id_allowed() {
! spctl --status -v 2> /dev/null | grep -q 'developer id disabled'
}
# Why Gatekeeper turned something down: this Mac only allows App Store apps,
# or it isn't notarized
gatekeeper_refused() {
if ! developer_id_allowed; then
echo "${RED}Gatekeeper doesn't accept $1: this Mac only allows apps from the App Store.$RESET"
echo "In System Settings > Privacy & Security, allow applications from the App Store"
echo "and identified developers, then try again."
else
echo "${RED}Gatekeeper doesn't accept $1 (it isn't notarized). Not installing it.$RESET"
fi
}
# Install a downloaded .pkg, once it's checked. The installer needs admin.
install_pkg() {
local pkg="$1"
verify_team "The download" "$(pkg_team "$pkg")" || return 1
if ! spctl --assess --type install "$pkg" 2> /dev/null; then
echo "${RED}Gatekeeper doesn't accept the download (it isn't notarized). Not installing it.$RESET"
gatekeeper_refused "the download"
return 1
fi
echo "Installing $APP_TITLE needs your Mac password."
@@ -123,7 +141,7 @@ install_dmg() {
elif ! verify_team "$APP_BUNDLE" "$(app_team "$app")"; then
status=1
elif ! spctl --assess --type execute "$app" 2> /dev/null; then
echo "${RED}Gatekeeper doesn't accept $APP_BUNDLE (it isn't notarized). Not installing it.$RESET"
gatekeeper_refused "$APP_BUNDLE"
status=1
elif ! ditto "$app" "/Applications/$APP_BUNDLE" 2> /dev/null; then
echo "Copying $APP_TITLE to Applications needs your Mac password."
+18 -2
View File
@@ -92,7 +92,7 @@ sftp_mounted() {
# mounted. reconnect and ServerAlive* bring it back after the network drops
# (e.g. sleep); idmap=user shows your files on the server as yours here.
sftp_mount() {
local url="$1" point="$2" backend opts
local url="$1" point="$2" backend opts pid i
backend="$(fuse_backend)" || return 1
sftp_parse "$url"
use_ssh_agent
@@ -104,7 +104,23 @@ sftp_mount() {
mkdir -p "$point" || return 1
opts="$opts,defer_permissions,noappledouble"
fi
"$SSHFS" "$SFTP_USER@$SFTP_HOST:$SFTP_PATH" "$point" -o "$opts"
# With macFUSE's extension off, SSHFS waits forever (and ignores TERM), so
# it gets 30 seconds
"$SSHFS" "$SFTP_USER@$SFTP_HOST:$SFTP_PATH" "$point" -o "$opts" &
pid=$!
for i in $(seq 1 30); do
kill -0 "$pid" 2> /dev/null || { wait "$pid"; return; }
sleep 1
done
kill -TERM "$pid" 2> /dev/null
sleep 2
kill -KILL "$pid" 2> /dev/null
wait "$pid" 2> /dev/null
if [ "$backend" = fskit ]; then
echo "SSHFS didn't finish mounting. Is macFUSE turned on in System Settings, under"
echo "General > Login Items & Extensions > File System Extensions?"
fi
return 1
}
sftp_unmount() {