From f0b976c81035e112938b8b9cf69194f8456ceadf Mon Sep 17 00:00:00 2001 From: Arpit Khandelwal <68700864+Arpit-Khandelwal@users.noreply.github.com> Date: Wed, 14 Oct 2026 01:00:29 +0530 Subject: [PATCH 1/2] fix(install): scope ownership changes to TetherKit's own files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit install-helper.sh recursively chowns the entire shared /Library/PrivilegedHelperTools directory. When another app has already installed a macOS-protected helper bundle there (e.g. ChromeRemoteDesktopHost.app, which carries a com.apple.macl attribute), chown returns "Operation not permitted" on those files. Under `set -euo pipefail` the script aborts right there — before it copies the LaunchDaemon plist and runs `launchctl bootstrap`. The helper binary and dylibs land on disk, but the daemon is never registered, so the install appears to finish while the helper stays permanently unreachable. Only chown/chmod the files this tool actually installs (the helper binary and its libtetherkit/libusb dylibs) instead of the entire shared directory. Other apps' helpers in the same directory are left untouched. --- gui/Scripts/install-helper.sh | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/gui/Scripts/install-helper.sh b/gui/Scripts/install-helper.sh index 8ac86e0..e50db9e 100755 --- a/gui/Scripts/install-helper.sh +++ b/gui/Scripts/install-helper.sh @@ -77,10 +77,21 @@ fi # and it must NOT be group- or other-writable. When that is violated, launchd # refuses to load it with the vague "Service cannot load in requested # session". -chown -R root:wheel "${TOOLS_DIR}" +# +# ⚠ 只调整本工具自己装进来的文件,**绝不** chown -R 整个 TOOLS_DIR。 +# /Library/PrivilegedHelperTools 由所有特权 helper 共享,里面可能有别的 App 装的、 +# 受 macOS 保护(com.apple.macl)的 bundle(例如 ChromeRemoteDesktopHost.app)。 +# 对那些文件 chown 会返回 "Operation not permitted",在 set -euo pipefail 下直接 +# 中断脚本 —— 二进制已经拷进去了,但后面的 plist 安装与 launchctl bootstrap 全都 +# 没跑,表现成「脚本跑完了,helper 却仍然不可达」。 chmod 755 "${TOOLS_DIR}" +chown -h root:wheel "${INSTALL_PATH}" "${TOOLS_DIR}"/libtetherkit*.dylib +if compgen -G "${TOOLS_DIR}/libusb-*.dylib" >/dev/null; then + chown -h root:wheel "${TOOLS_DIR}"/libusb-*.dylib +fi chmod 544 "${INSTALL_PATH}" -find "${TOOLS_DIR}" -maxdepth 1 -name '*.dylib' -type f -exec chmod 444 {} + +find "${TOOLS_DIR}" -maxdepth 1 -type f \ + \( -name 'libtetherkit*.dylib' -o -name 'libusb-*.dylib' \) -exec chmod 444 {} + log "Installing ${PLIST_PATH}" cp "${SOURCE_DIR}/${LABEL}.plist" "${PLIST_PATH}" From adb7f9918876573363f9895207f11e64e51121f6 Mon Sep 17 00:00:00 2001 From: Justin <159104807+Justin24506@users.noreply.github.com> Date: Sat, 21 Nov 2026 18:01:14 +0530 Subject: [PATCH 2/2] fix(install): finish the scoped chown --- gui/Scripts/install-helper.sh | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/gui/Scripts/install-helper.sh b/gui/Scripts/install-helper.sh index e50db9e..56919b8 100755 --- a/gui/Scripts/install-helper.sh +++ b/gui/Scripts/install-helper.sh @@ -78,20 +78,25 @@ fi # refuses to load it with the vague "Service cannot load in requested # session". # -# ⚠ 只调整本工具自己装进来的文件,**绝不** chown -R 整个 TOOLS_DIR。 -# /Library/PrivilegedHelperTools 由所有特权 helper 共享,里面可能有别的 App 装的、 -# 受 macOS 保护(com.apple.macl)的 bundle(例如 ChromeRemoteDesktopHost.app)。 -# 对那些文件 chown 会返回 "Operation not permitted",在 set -euo pipefail 下直接 -# 中断脚本 —— 二进制已经拷进去了,但后面的 plist 安装与 launchctl bootstrap 全都 -# 没跑,表现成「脚本跑完了,helper 却仍然不可达」。 +# Touch only the files this tool installs. /Library/PrivilegedHelperTools is +# shared by every privileged helper, and a bundle protected by +# com.apple.macl (ChromeRemoteDesktopHost.app, for example) rejects chown +# even for root. Under set -euo pipefail the script then aborts after +# copying the binary but before it installs the plist and runs launchctl +# bootstrap, so the install looks finished while the helper stays +# unreachable. +chown root:wheel "${TOOLS_DIR}" chmod 755 "${TOOLS_DIR}" -chown -h root:wheel "${INSTALL_PATH}" "${TOOLS_DIR}"/libtetherkit*.dylib +chown -h root:wheel "${INSTALL_PATH}" +if compgen -G "${TOOLS_DIR}/libtethernet*.dylib" >/dev/null; then + chown -h root:wheel "${TOOLS_DIR}"/libtethernet*.dylib +fi if compgen -G "${TOOLS_DIR}/libusb-*.dylib" >/dev/null; then chown -h root:wheel "${TOOLS_DIR}"/libusb-*.dylib fi chmod 544 "${INSTALL_PATH}" find "${TOOLS_DIR}" -maxdepth 1 -type f \ - \( -name 'libtetherkit*.dylib' -o -name 'libusb-*.dylib' \) -exec chmod 444 {} + + \( -name 'libtethernet*.dylib' -o -name 'libusb-*.dylib' \) -exec chmod 444 {} + log "Installing ${PLIST_PATH}" cp "${SOURCE_DIR}/${LABEL}.plist" "${PLIST_PATH}"