Skip to content

Commit 66c7627

Browse files
authored
Relax rsync path for permissions workaround in macOS 15.4+ (#2710)
This fixes `rsync` permission issues in macOS 15.4+ if users instead use a working `rsync` binary (e.g. one from Homebrew).
1 parent bb2e7ef commit 66c7627

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

apple/internal/templates/apple_device.template.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
import pathlib
4040
import platform
4141
import plistlib
42+
import shutil
4243
import subprocess
4344
import sys
4445
import tempfile
@@ -300,8 +301,15 @@ def extracted_app(
300301
# fail with `Unhandled error domain NSPOSIXErrorDomain, code 13`.
301302
dst_dir = os.path.join(tempfile.gettempdir(), "bazel_temp_" + app_name)
302303
os.makedirs(dst_dir, exist_ok=True)
304+
305+
# NOTE: use `which` to find the path to `rsync`.
306+
# In macOS 15.4, the system `rsync` is using `openrsync` which contains some permission issues.
307+
# This allows users to workaround the issue by overriding the system `rsync` with a working version.
308+
# Remove this once we no longer support macOS versions with broken `rsync`.
309+
rsync_path = shutil.which("rsync")
310+
303311
rsync_command = [
304-
"/usr/bin/rsync",
312+
rsync_path,
305313
"--archive",
306314
"--delete",
307315
"--checksum",

apple/internal/templates/apple_simulator.template.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ def is_apple_tv(self) -> bool:
132132

133133
def is_apple_watch(self) -> bool:
134134
return self.has_product_family_or_identifier("Apple Watch")
135-
135+
136136
def is_apple_vision(self) -> bool:
137137
return self.has_product_family_or_identifier("Apple Vision")
138138

@@ -537,8 +537,15 @@ def extracted_app(
537537
# fail with `Unhandled error domain NSPOSIXErrorDomain, code 13`.
538538
dst_dir = os.path.join(tempfile.gettempdir(), "bazel_temp_" + app_name)
539539
os.makedirs(dst_dir, exist_ok=True)
540+
541+
# NOTE: use `which` to find the path to `rsync`.
542+
# In macOS 15.4, the system `rsync` is using `openrsync` which contains some permission issues.
543+
# This allows users to workaround the issue by overriding the system `rsync` with a working version.
544+
# Remove this once we no longer support macOS versions with broken `rsync`.
545+
rsync_path = shutil.which("rsync")
546+
540547
rsync_command = [
541-
"/usr/bin/rsync",
548+
rsync_path,
542549
"--archive",
543550
"--delete",
544551
"--checksum",

0 commit comments

Comments
 (0)