From 85e0f228ed67f1d7c62e2f5ea81f013b98f9d658 Mon Sep 17 00:00:00 2001 From: Kitty Hutchinson <78680015+kittyhutchinson@users.noreply.github.com> Date: Sun, 4 Jan 2026 15:19:58 +0000 Subject: [PATCH] fix macOS compatibility --- utils/sdr/detection.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/utils/sdr/detection.py b/utils/sdr/detection.py index 6c996d5..f6b15cf 100644 --- a/utils/sdr/detection.py +++ b/utils/sdr/detection.py @@ -81,13 +81,21 @@ def detect_rtlsdr_devices() -> list[SDRDevice]: return devices try: + import os + import platform + env = os.environ.copy() + + if platform.system() == 'Darwin': + lib_paths = ['/usr/local/lib', '/opt/homebrew/lib'] + current_ld = env.get('DYLD_LIBRARY_PATH', '') + env['DYLD_LIBRARY_PATH'] = ':'.join(lib_paths + [current_ld] if current_ld else lib_paths) result = subprocess.run( ['rtl_test', '-t'], capture_output=True, text=True, - timeout=5 + timeout=5, + env=env ) - output = result.stderr + result.stdout # Parse device info from rtl_test output # Format: "0: Realtek, RTL2838UHIDIR, SN: 00000001" @@ -306,3 +314,4 @@ def detect_all_devices() -> list[SDRDevice]: logger.debug(f" {d.sdr_type.value}:{d.index} - {d.name} (serial: {d.serial})") return devices +