Skip to content

Commit cb8839e

Browse files
committed
Actions: Manipulate DYLD_* on macos inside of run.m
1 parent 17b494e commit cb8839e

1 file changed

Lines changed: 7 additions & 12 deletions

File tree

.github/workflows/unix_unit_tests.yml

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -418,16 +418,6 @@ jobs:
418418
with:
419419
release: ${{ matrix.matlab-version }}
420420

421-
# macOS: MATLAB's bundled libssl is missing _SSL_get0_group_name needed by
422-
# netCDF4's libcurl. Set DYLD_LIBRARY_PATH so conda's OpenSSL is found first.
423-
# NOTE: Must be AFTER "Set up MATLAB" or MATLAB installer fails with _iconv error
424-
- name: Fix OpenSSL compatibility for macOS
425-
if: runner.os == 'macOS'
426-
shell: bash -l {0}
427-
run: |
428-
conda activate mhkit_conda_env
429-
echo "DYLD_LIBRARY_PATH=$CONDA_PREFIX/lib:$DYLD_LIBRARY_PATH" >> "$GITHUB_ENV"
430-
431421
# - name: Configure OpenSSL for MacOS/MATLAB
432422
# if: runner.os == 'macOS'
433423
# shell: bash -l {0}
@@ -447,12 +437,17 @@ jobs:
447437
python -c "
448438
import sys
449439
import platform
440+
import os
450441
451442
python_exe = sys.executable
452443
is_macos = platform.system() == 'Darwin'
453444
454-
# macOS needs DYLD_LIBRARY_PATH passed to MATLAB
455-
dyld_line = \"setenv('DYLD_LIBRARY_PATH', getenv('DYLD_LIBRARY_PATH'));\" if is_macos else ''
445+
# macOS: Set DYLD_LIBRARY_PATH directly in run.m (not via env var)
446+
# This avoids breaking MATLAB's launcher while still fixing OpenSSL for Python
447+
dyld_line = ''
448+
if is_macos:
449+
conda_lib_path = os.path.join(os.path.dirname(os.path.dirname(python_exe)), 'lib')
450+
dyld_line = f\"setenv('DYLD_LIBRARY_PATH', '{conda_lib_path}');\"
456451
457452
content = f'''pyenv(Version='{python_exe}', ExecutionMode='OutOfProcess')
458453
{dyld_line}

0 commit comments

Comments
 (0)