Hi Johannes,
I have just overcome the same issue of my laptop (running macOS Big Sur).
In order to edit the env var DYLD_LIBRARY_PATH you need to disable the System Integrity Protection (SIP) of macOS. To do so, you have to boot you computer in Recovery Mode, open the Terminal from Utilities and type
csrutil disable
More info about SIP here: Configuring System Integrity Protection
Place where I found the solution: DYLD environment variable woes on OS X Sierra when running Ant: Library not loaded libANML_g.dylib · Issue #181 · nasa/europa · GitHub
From now on, you’ll be able to edit the env var, and hopefully, solve the problem in a clean way.
Best,
Andrea