Ravi Kiran Ravi Kiran - 2 months ago 12
iOS Question

error with Uncrustify in xcode for an ios app

I have installed the uncrustify through brew (as per the git instructions), and I have added the run script build phase to the xcode and tried to build an ios project, but the build is failing with the following error:

**/bin/sh: /Users/test/Library/Developer/Xcode/DerivedData/testProj- amlbymrfycxuzmemclwtovltjxzl/Build/Intermediates/testProj.build/Debug-iphoneos/testProj.build/Script-AC898878187BE0A00056CAB1.sh: sh: bad interpreter: No such file or directory**

How can I resolve this error? Any help would be appreciated. Thanks in advance.

My sh script:

if [ -n "$1" ]

# recover directory to format :
pathToSourcesDirectory=`echo $(pwd)/$1`

# go to current folder :
scriptDirectory=$(dirname $0)
cd $scriptDirectory

# find sources files to format :
echo ""
echo "==> Getting files to format in directory " + $pathToSourcesDirectory
mkdir -p temp
find $pathToSourcesDirectory -name "*.[mh]" > temp/sources_to_uncrustify.txt

# format files :
echo ""
echo "==> Format files"
/usr/local/bin/uncrustify -F temp/sources_to_uncrustify.txt -c "../uncrustify_objective_c.cfg" --no-backup

# remove temp files :
rm -rf temp/

echo "Error : You must specify a source folder as first parameter"



It looks like you don't have Shell set to /bin/sh in the Xcode Run Script configuration:

enter image description here

(screenshot taken from here).