Search Unity

command /bin/sh failed with exit code 126 xcode build failed

Discussion in 'iOS and tvOS' started by dhanrajsinh24, Jan 27, 2016.

  1. dhanrajsinh24

    dhanrajsinh24

    Joined:
    May 8, 2014
    Posts:
    59
    Hi, I have build my Unity iOS project with Unity 5.3.1 and opened in Xcode 7.1.1. My build is failed with this error :

    command /bin/sh failed with exit code 126

    Full Error :
    /Users/user115808/Library/Developer/Xcode/DerivedData/Unity-iPhone-ffdxnkcrmjhfcnakjerkxowcoefc/Build/Intermediates/ArchiveIntermediates/Unity-iPhone/IntermediateBuildFilesPath/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Script-033966F41B18B03000ECD701.sh: /Users/user115808/Downloads/Glory Days_v4/MapFileParser.sh: /bin/sh: bad interpreter: Operation not permitted
    Command /bin/sh failed with exit code 126


     
  2. dhanrajsinh24

    dhanrajsinh24

    Joined:
    May 8, 2014
    Posts:
    59
    xattr -d com.apple.quarantine "Path to MapFileParser.sh"

    This solved my problem but ran into another problem Permission Denied and that was solved by :
    chmod +x "Path to MapFileParser.sh"
     
    Tethip likes this.
  3. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,930
    @dhanrajsinh24

    These permissions should have been set up correctly by the Unity installer. Ddi you happen to copy the installation directory from another location (and possibly modify the permissions)?
     
  4. dhanrajsinh24

    dhanrajsinh24

    Joined:
    May 8, 2014
    Posts:
    59
    I made build on Windows and took Xcode project into another mac and used. could it be the problem?
     
  5. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,930
    @dhanrajsinh24

    Yes, that could be it. If the execute permission was lost from the MapFileParser.sh file during the copy, that would cause this problem.
     
  6. r618

    r618

    Joined:
    Jan 19, 2009
    Posts:
    1,305
    yes, that is the problem, got the same situation recently ( build on windows -> zip -> copy archive on mac )
    x flag has to be set manually on the script ( no need to delete extended attribute though )
     
  7. dhanrajsinh24

    dhanrajsinh24

    Joined:
    May 8, 2014
    Posts:
    59
    Okay got it, Is there any solution for that? How to avoid it from happening?
     
  8. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,930
    @dhanrajsinh24

    I'm not sure of a good solution to handle this case. If possible, can you execute a script on the OSX machine after the copy from Windows to set the permission on this file correctly?
     
  9. Deleted User

    Deleted User

    Guest

    I ran into same problem this problems happen when you build your project on some another mac and export it to another mac and again open in xcode. the simple solution is go the Build Phase-> then at bottom Expand the option Run Script -> and then check the Box [Run Script Only When Installing].
     
    unity_DeDRAx4AcF-bUg likes this.
  10. caspertan

    caspertan

    Joined:
    Aug 16, 2018
    Posts:
    3
    is there any solution on this matter ?
    i am using Unity 2017.4 ( windows ) then build for mac and achieve to .rar and using Xcode 10 on a mac pro. and i get the below error :-

    [ MapFileParser.sh: Permission Denied]
    Command PhaseScriptExecution failed with a nonzero exit code
     
  11. aurora-loop

    aurora-loop

    Joined:
    May 1, 2018
    Posts:
    1
    Is there a way I can configure this for Xcode from the CLI? Im building using the CLI. Originally built in unity windows and moved into a macOS. I'm building using the CLI in macOS