How to use sudo inside of a Run Script build phase in Xcode 4?

后端 未结 7 1900
梦谈多话
梦谈多话 2021-02-02 14:47

I need use execute a command inside of a script in a Run Script build phase in Xcode 4 using sudo. However, the compiler complains:

sudo: no tty present a

7条回答
  •  一整个雨季
    2021-02-02 15:05

    Another solution to this problem is to modify sudoers file and add your account to it and state that you should never be asked for the sudo password. To accomplish this is fairly straightforward:

    run:

    sudo visudo
    

    In the User privilege specification section add a line that looks like

    youraccountname ALL=(ALL) NOPASSWD: ALL
    

    Of course, this can be a dangerous thing to do, so be careful. I would suggest reading the man page for sudoers and visudo before going this route.

提交回复
热议问题