People said it does not work.
{
    std::initializer_list<const char *> harmful_env_variables = {
        
        "LD_PRELOAD",
        "LD_LIBRARY_PATH",
        "LD_ORIGIN_PATH",
        "LD_AUDIT",
        "LD_DYNAMIC_WEAK",
        
        "DYLD_LIBRARY_PATH",
        "DYLD_FALLBACK_LIBRARY_PATH",
        "DYLD_VERSIONED_LIBRARY_PATH",
        "DYLD_INSERT_LIBRARIES",
    };
    bool require_reexec = false;
    for (const auto * var : harmful_env_variables)
    {
        if (const char * value = getenv(var); value && value[0])
        {
            
            if (setenv(var, "", true))
            {
                fmt::print(stderr, "Cannot override {} environment variable", var);
                _exit(1);
            }