dyld: DYLD_ environment variables being ignored because main executable (/usr/bin/sudo) is setuid or setgid

前端 未结 7 1710
遇见更好的自我
遇见更好的自我 2021-01-31 02:07

since an update to 10.8 I get the following error, when trying to do a sudo command, which is pretty annoying.

dyld: DYLD_ environment variables being ignored be         


        
7条回答
  •  遇见更好的自我
    2021-01-31 02:46

    Not sure where the official solve is for this, but I solved it with this bashrc hack, because I couldn't deal with seeing that damn warning any longer.

    put this in the /etc/bashrc or wherever yours lives.

    # set DYLD_* for my normal programs
    DYLD_LIBRARY_PATH='..'
     
    # set an alternative sudo
    thesudo()
    {
    # back up the DYLD_* variables
    local BACK=$DYLD_LIBRARY_PATH
    # unset DYLD_*
    unset DYLD_LIBRARY_PATH
    # calling sudo
    /usr/bin/sudo "$@"
    # restore DYLD_* after sudo finished
    export DYLD_LIBRARY_PATH=$BACK
    }
     
    # redirect sudo
    alias sudo=thesudo
    

提交回复
热议问题