0

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" ]
    then

    # 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/

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

fi
mkj
  • 2,761
  • 5
  • 24
  • 28
Ravi Kiran
  • 691
  • 3
  • 9
  • 22

1 Answers1

1

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).

trojanfoe
  • 120,358
  • 21
  • 212
  • 242
  • in the configuration i have added the file path like this sh CodeFormatter/scripts/formatOpenedSources.sh and i have added CodeFormatter/scripts/formatOpenedSources.sh file to the project – Ravi Kiran Jan 07 '14 at 09:52
  • @RaviKiran Change `sh` to `/bin/sh`. – trojanfoe Jan 07 '14 at 09:53