What permissions are required for “Run Script” dur

2019-01-23 03:32发布

In the "Run Script" build phase of my project, everything works if I type in the script into the text box for "run script" in build phases.

But to make editing / diffing etc easier, I thought I would save the script as a file as part of my project, and just fill in the path in the text box instead:

Eg: I paste the following path in the text box.

/Users/superman/Documents/Projects/SomeProject/scriptname.sh

But when I try to build this, I get a "Permission Denied" message.

What can I do to fix this? If I cut/paste the actual code, then it just "works". My user account is an administrator account. No one else uses my machine.

3条回答
仙女界的扛把子
2楼-- · 2019-01-23 03:54

Put /bin/sh in front of the path to the script name.

/bin/sh /Users/superman/Documents/Projects/SomeProject/scriptname.sh
查看更多
beautiful°
3楼-- · 2019-01-23 03:54

Just use

chmod u+x nameofscript.sh

Thats it .

查看更多
贪生不怕死
4楼-- · 2019-01-23 04:04

You can simplify your Xcode project file a little further and not require the "bin/sh " in front of the script name.

To avoid this, you need to turn on "execute" permissions for users (Xcode in this case) of the file.

Steps

  • Go into terminal
  • Navigate to where your script is
  • run chmod 755 yourScriptName.sh
查看更多
登录 后发表回答