dyld: DYLD_ environment variables being ignored be

2019-03-08 12:52发布

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 because main executable (/usr/bin/sudo) is setuid or setgid

What does that have to mean? I hope anyone can help.

7条回答
Fickle 薄情
2楼-- · 2019-03-08 13:23

Not sure if this is a true fix, but this error disappeared when I ran Clean Build Folder

查看更多
【Aperson】
3楼-- · 2019-03-08 13:26

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
查看更多
够拽才男人
4楼-- · 2019-03-08 13:31

Those who use django (python for web), with mysql through MySQLdb (Mysql-Python module), need that variable set. So I just keep the warning for now.

查看更多
够拽才男人
5楼-- · 2019-03-08 13:32

In zsh:

sudo () { ( unset LD_LIBRARY_PATH DYLD_LIBRARY_PATH; exec command sudo $* ) }

This spawns a sub-shell in which the environment variables sudo complains about are unset, and then executes sudo (via exec so that the now-unecessary parent shell exits immediately).

I'll leave it as an exercise to the reader to port to bash, et al.

查看更多
【Aperson】
6楼-- · 2019-03-08 13:34

This seems to be a bug introduced in 10.8, see this report. As far as I can tell, the only workaround is not setting DYLD_LIBRARY_PATH or LD_LIBRARY_PATH by default, but only when needed.

查看更多
Ridiculous、
7楼-- · 2019-03-08 13:36

This issue is finally fixed on OS X Mavericks (10.9), the message no longer comes up on sudo.

查看更多
登录 后发表回答