Search Unity

MapFileParser.sh: Permission denied - not set as executable in Unity 4.6.8p1

Discussion in 'iOS and tvOS' started by Dreamwriter, Sep 3, 2015.

  1. Dreamwriter

    Dreamwriter

    Joined:
    Jul 22, 2011
    Posts:
    472
    I just installed Unity 4.6.8p1 on PC, made a build, copied the build folder to my Mac, and when I build it I get

    Shell Script Invocation Error....MapFileParser.sh: Permission denied

    It seems the file isn't being set as executable, when I do a chmod +x on it, the build works.
     
    Guhanesh and Mmm_Dev like this.
  2. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,938
    @Dreamwriter

    I'm not sure that there is much we can do to correct this. When the file is copied from Windows to OSX, is there a way to specify the executable permission on it? I'm not sure that there is.
     
  3. Dreamwriter

    Dreamwriter

    Joined:
    Jul 22, 2011
    Posts:
    472
    Not sure, but this problem didn't happen in the previous Unity version that I had (that's how we make most of our builds here, build on PC, copy to Mac, build and push in Xcode)
     
  4. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,938
    @Dreamwriter

    Which version of Unity did you have previously where this worked? I wonder if it did not have the MapFileParser step. If so, we then we would like to take a closer look at this. Can you submit a bug report? Please include the process you use to set up the build environment.
     
  5. Dreamwriter

    Dreamwriter

    Joined:
    Jul 22, 2011
    Posts:
    472
    What I was using before was 4.6.7p2. I'll submit a bug report but I can't include the project with it
     
  6. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,938
    @Dreamwriter

    I believe that 4.6.7p2 had the MapFileParser step, so thanks for submitting the bug report. I don't think that a project is necessary for this bug.
     
  7. Dreamwriter

    Dreamwriter

    Joined:
    Jul 22, 2011
    Posts:
    472
    Case #725127
     
  8. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,938
    @Dreamwriter

    Thanks, we will investigate this bug.
     
  9. mikaelgustafsson

    mikaelgustafsson

    Joined:
    Mar 6, 2014
    Posts:
    15
    I'm having the same problem. Can you explain how I do a chmod +x?
     
  10. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,938
    @mikaelgustafsson

    You can run the command man chmod for more details about chmod, but you should be able to run this command on the OSX machine:

    chmod +x /path/to/MapFileParser

    This will set the exectuable permission on the MapFileParser utility, and allow it to be run.
     
  11. Mr_Flappy

    Mr_Flappy

    Joined:
    Aug 4, 2015
    Posts:
    7
    I'm having a similar problem, going to try the chmod command and see if it works. I also compiled on windows and sent to my mac
     
  12. Mr_Flappy

    Mr_Flappy

    Joined:
    Aug 4, 2015
    Posts:
    7
    the chmod +x command worked for me!
     
    URPian and ultimatemobile like this.
  13. Simon_says

    Simon_says

    Joined:
    Oct 19, 2013
    Posts:
    141
    This issue still exists in 5.3.5p7, I always have to manually set this permission in the terminal later if building xcode project on PC and moving files to Mac.
     
  14. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,938
    @Simon_says

    I don't think that this is an issue we can easily correct, unfortunately. Since Unity is not doing to copy from the PC to the Mac, we don't control how the permissions are set (or not, in this case).
     
  15. erik_fonseka

    erik_fonseka

    Joined:
    Nov 16, 2016
    Posts:
    1
    When I zip the files on PC, then copy to Mac, the unzip it, it seems to preserve all the permissions. This workaround works best for me and resolves the "Permission denied" error in XCode.
     
    triple_why and DTFun like this.
  16. necott

    necott

    Joined:
    Jan 28, 2017
    Posts:
    1
  17. PlayJoWee

    PlayJoWee

    Joined:
    Feb 13, 2014
    Posts:
    2
    Set attributer read-write for all users and groups and all will be fixed :)
     
  18. ScottAdams

    ScottAdams

    Joined:
    Nov 23, 2016
    Posts:
    72
    @PlayJoWee how do you do that? Can you give the steps. I am still learning the Apple ecosystem.
     
  19. tarahugger

    tarahugger

    Joined:
    Jul 18, 2014
    Posts:
    129
    Sorry to necropost but this just occurred for me with 2017.3.0f3, and this was a top result in google.

    The error appeared when i started pushing files FROM the windows machine onto a shared drive/folder on the mac .

    I tried changing the file permissions on the files directly on the mac, and it still threw the error despite 'everyone' having read/write access.

    The solution was to instead, go onto the mac, and pull the files off a windows network drive. Apparently when doing it this way the mac is able to set the file permissions properly.
     
  20. gracezhu

    gracezhu

    Joined:
    Apr 24, 2018
    Posts:
    3
    If you hate the command line or can't use it for whatever reason you can usually have scripts run without -x (execute) permission by adding 'bash ' in front of the script under Build Phases>Run Script in XCode
    i.e. bash "$PROJECT_DIR/MapFileParser.sh" should work
     
  21. scheidtventureestate

    scheidtventureestate

    Joined:
    Nov 28, 2017
    Posts:
    33
    @JoshPeterson This just happened to me on 2018.10f2
    Would be great if you can sort it out.

    We use a dropbox account to sync the build artefacts; which by the way, is the most reliable way to not run into permission madness with windows network sharing and ensure everything is in sync blazingly fast as dropbox will snyc over LAN, when the machine with differences are in the same local network. This also syncs permissions. So on your mac, go into your ios-build folder in dropbox and run once

    sudo chmod -R 777 .


    This will set all permissions of all files and sync it back to the windows machines via dropbox; respecting now the set permissions.

    Do use version control for your unity project though!
     
    Last edited: May 26, 2018
  22. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,938
    Are there two separate problems here? One is the shell script line with a Windows line ending, and one is the MapFIleParser.sh permission issue (if I've understood your post).

    If so, can you submit a bug report for the line ending issue - that should be easy to correct.

    I'm not sure what we can do about the permissions issue, it might be a limitation of the OS.
     
  23. scheidtventureestate

    scheidtventureestate

    Joined:
    Nov 28, 2017
    Posts:
    33
    I am on vacation now and can not submit stuff
     
  24. vinnie-vivace

    vinnie-vivace

    Joined:
    Jan 12, 2010
    Posts:
    40
    @scheidtventureestate thank you for the fix.

    @JoshPeterson has there been any progress on this? Im running the latest IDE, building iOS from Windows to an OSX shared drive and hitting the same issue.
     
  25. nguyenkhanh30303

    nguyenkhanh30303

    Joined:
    Sep 11, 2017
    Posts:
    1
    [QUOTE = "gracezhu, post: 3500644, member: 1790438"] Nếu bạn ghét dòng lệnh hoặc không thể sử dụng nó vì bất kỳ lý do gì bạn thường có thể chạy các script mà không cần sự cho phép -x (thực thi) bằng cách thêm 'bash' vào trước của tập lệnh trong Tạo giai đoạn> Chạy tập lệnh trong XCode
    tức là bash "$ PROJECT_DIR / MapFileParser.sh" sẽ hoạt động [/ QUOTE]
    thank you!!!
     
  26. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,938
    No, we've not made any progress on this issue. If you can drop us a bug report, we will have a look.
     
  27. montee-fasy

    montee-fasy

    Joined:
    Jun 11, 2018
    Posts:
    1
    Showing All Messages
    /Users/faisalmumtaz/Library/Developer/Xcode/DerivedData/Unity-iPhone-aqzssptynwseuecmulzbxmtwdxoc/Build/Intermediates.noindex/Unity-iPhone.build/ReleaseForRunning-iphoneos/Unity-iPhone.build/Script-033966F41B18B03000ECD701.sh: line 2: /Users/faisalmumtaz/Desktop/Shiekh zayed memorial/builds/IOS Project/Ios/MapFileParser.sh: Permission denied


    NEED help i m using xcode9.4
     
  28. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,938
    Try to manually modify the permissions of MapFileParser.sh to make it executable.
     
    shafin1911 likes this.
  29. vinnie-vivace

    vinnie-vivace

    Joined:
    Jan 12, 2010
    Posts:
    40
  30. DTFun

    DTFun

    Joined:
    Sep 24, 2017
    Posts:
    2
    This. Thanks alot!
     
  31. Zilk

    Zilk

    Joined:
    May 10, 2014
    Posts:
    333
    There is a new issue with this in macOS Catalina with Xcode 10.3. First you get the permission denied, when setting +x it throws "MapFileParser.sh" can't be opened because it's integrity cannot be verified.
     
  32. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,938
    Can you submit a bug report for this issue?
     
  33. triple_why

    triple_why

    Joined:
    Jun 9, 2018
    Posts:
    47
    That works for me too. Just a note; don't use 7z format but use zip format, as zip format does store fat type permissions, while 7z does not.

    * at windows, compress Xcode project folder as zip format (LZMA method compresses better than deflate method)
    * at mac, unzip it with The Unarchiver

    (Windows 10 / Unity 2019.2.2, macos high sierra 10.13.6 / Xcode 10.1)
     
    Last edited: Aug 29, 2019
    EL-soNK and alvarometon like this.
  34. Amar1312

    Amar1312

    Joined:
    Sep 19, 2018
    Posts:
    2
    You can run the command man chmod for more details about chmod, but you should be able to run this command on the OSX machine:

    chmod a+x /path/to/MapFileParser

    dont forget to restart X code again as well "a+x"..

    It works for me.......
     
    keni4 likes this.
  35. VigorousApathy

    VigorousApathy

    Joined:
    Dec 22, 2012
    Posts:
    12
    This solution worked for me on version 2018.4.13f1
     
  36. CanisLupus

    CanisLupus

    Joined:
    Jul 29, 2013
    Posts:
    427
    This started happening for us recently when building on a Catalina iMac. We always use zip files when moving from Windows anyway. The error appears for MapFileParser.sh and then for process_symbols.sh.

    The above works by recursively applying a+x to all files in the current folder (replace . with the folder if you wish) but it's annoying to have to do this all the time. Not sure if anything can be done on Unity's end, though.
     
    keni4 likes this.
  37. alvarometon

    alvarometon

    Joined:
    Jul 9, 2012
    Posts:
    3
    This works for me! Thanks
     
  38. retox

    retox

    Joined:
    Sep 12, 2012
    Posts:
    29
    We exported out on Windows via zip and copied over to a Mac using Catalina. At first used the default Archive Utility and this issue happened. Found this and used the Unarchiver and works fine.
     
  39. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    1,648
    @retox Ya using Unarchiver was the key for me. Downloadable in the Apple Store for free. Didn't have to change any permissions.
     
  40. Emanx140

    Emanx140

    Joined:
    Jan 13, 2017
    Posts:
    9
    Hi!
    For me the solution was:
    1) Set permission running chmod +x command for "MapFileParser.sh"
    2) In "MapFileParser.sh" replace the first line from
    #!/bin/sh
    to
    #!/bin/bash
     
  41. xucian

    xucian

    Joined:
    Mar 7, 2016
    Posts:
    846
    I ended up creating a .command script which I'm always running before opening the project on OSX (Open with->Terminal):
    Code (CSharp):
    1.         void CreateFixIOSBuildScriptsCommandFile(BuildReport report)
    2.         {
    3.             var filePath = report.summary.outputPath + "/runme_fix_permissions.command";
    4.  
    5.             File.WriteAllText(
    6.                 filePath,
    7.                 "# This fixes errors where Xcode couldn't execute these scripts" + "\n" +
    8.  
    9.                 // Needed because current directory is not set when running .command files. gearsdigital's life-saving comment on this SO answer: https://stackoverflow.com/a/9650209
    10.                 "cd \"`dirname \"$0\"`\"" + "\n" +
    11.  
    12.                 "chmod a+x MapFileParser.sh" + "\n" +
    13.                 "chmod a+x process_symbols.sh"
    14.             );
    15.         }
    Add it to your post-build event in Unity.
    For ex:
    Code (CSharp):
    1. using UnityEditor;
    2. using UnityEditor.Build;
    3. using UnityEditor.Build.Reporting;
    4. #if UNITY_IOS
    5. using UnityEditor.iOS.Xcode;
    6. #endif
    7.  
    8. namespace YourNamespace
    9. {
    10.     public class PostprocessBuildUtility : IPostprocessBuildWithReport
    11.     {
    12.         int IOrderedCallback.callbackOrder { get { return 10000; } }
    13.  
    14.         void IPostprocessBuildWithReport.OnPostprocessBuild(BuildReport report)
    15.         {
    16.             if (report.summary.result != BuildResult.Succeeded && report.summary.result != BuildResult.Unknown)
    17.                 return;
    18.             ManageIOSPostBuild(report);
    19.         }
    20.  
    21.         void ManageIOSPostBuild(BuildReport report)
    22.         {
    23. #if UNITY_IOS
    24.             if (report.summary.platform == BuildTarget.iOS) // Check if the build is for iOS
    25.             {
    26.                 .. some other code you may have here for managing the iOS build ..
    27.  
    28.                 // Simply create a .command file which can be run in OSX to fix some permissions
    29.                 CreateFixIOSBuildScriptsCommandFile(report);
    30.             }
    31. #endif
    32.         }
    33.     }
    34. }
    Wish there could be something implemented by Unity that won't require us to do this.

    Lucian

    Edit 19.09.2021: New file needs permissions as well (I think in Unity 2020):
    Code (CSharp):
    1. chmod +x usymtool
     
    Last edited: Sep 19, 2021
  42. CrystalDynamo

    CrystalDynamo

    Joined:
    May 22, 2014
    Posts:
    120
    Same problem again on unity 2019.4.1f1
     
    Alex_StudioDrydock likes this.
  43. Alex_StudioDrydock

    Alex_StudioDrydock

    Joined:
    Jan 16, 2019
    Posts:
    9
    This also hit me with the 2019.4.1f1 upgrade, however I believe the issue relates to installing from the command-line on macOS instead of with Unity Hub. I use the UnitySetup PowerShell tools to manage Unity installs, which internally install the package according to the Unity command-line instructions (i.e., using sudo installer) into a temporary volume, and then rsync's these files to the destination directory (this is necessary because the installer tool doesn't allow installation into arbitrary directories).

    By contrast, Unity Hub directly extracts the .pkg with xar and tar, skipping the postinstall script within the .pkg.

    Within the .tar file the permissions are correct, but somewhere during the installer process the execute bits on MapFileParser.sh are lost.
     
    CrystalDynamo likes this.
  44. CrystalDynamo

    CrystalDynamo

    Joined:
    May 22, 2014
    Posts:
    120
    I have the drive mapped on my pc to the mac . I just copy the folder to it and am not archiving at all.
     
  45. BilalShahid

    BilalShahid

    Joined:
    Sep 16, 2014
    Posts:
    5
    I zipped the iOS build file from PC and Unzipped in my mac. I set up command in terminal

    (base) Name-MBP:~ UserNameMac$ chmod +x /path/to/MapFileParser

    It is perfectly working on latest version of Unity 2019.4 and Xcode 11.5.

    Note: Copy the path when you will go to the folder and right click the MapFileParser.sh file and then click "Copy MapFileParser.sh" option.
     
  46. CrystalDynamo

    CrystalDynamo

    Joined:
    May 22, 2014
    Posts:
    120
    ATM I empty the folder on the MAC and copy the new xcode files into that and just do a chmod 777 *.sh as I leave the terminal window open along with xcode. But I am now going to try generating the xcode project directly to the macs drive via a share to the PC. If that works that will save me about 1.5 minutes in getting it there.

    TRIED IT, that sucked still had to do the chmod 777 and lost the folder so the terminal folder was moot and had to change folders again.
     
    Last edited: Jul 10, 2020
  47. VenkarD

    VenkarD

    Joined:
    Nov 20, 2017
    Posts:
    1
    Yes, its works for me!
     
  48. allseeingeye

    allseeingeye

    Joined:
    Feb 14, 2017
    Posts:
    1
    For anyone else still facing this issue in Unity 2020, you can save the following script (attached also) to an Editor folder in your project and it will take care of setting the correct permissions when Xcode builds (you need to clean your Xcode project if built previous for this to take effect)

    Code (CSharp):
    1.  
    2. using UnityEngine;
    3. #if UNITY_EDITOR
    4. using UnityEditor;
    5. #endif
    6. #if UNITY_IOS || UNITY_IPHONE
    7. using UnityEditor.iOS.Xcode;
    8. #endif
    9. using UnityEditor.Callbacks;
    10.  
    11. public static class iOSBuildPermissionFix
    12. {
    13. #if UNITY_EDITOR && (UNITY_IOS || UNITY_IPHONE)
    14.     [PostProcessBuild(0)]
    15.     public static void OnPostProcessBuild(BuildTarget buildTarget, string path)
    16.     {
    17.         if (buildTarget != BuildTarget.iOS)
    18.         {
    19.             return;
    20.         }
    21.  
    22.         string projectPath = PBXProject.GetPBXProjectPath(path); ;
    23.         PBXProject pbxProject = new PBXProject();
    24.         pbxProject.ReadFromFile(projectPath);
    25.  
    26.         string targetGUID = pbxProject.GetUnityFrameworkTargetGuid();
    27.  
    28.         string shellPath = "/bin/sh";
    29.         int index = 0;
    30.         string name = "Fix Permissions in Windows Generated XcodeProject";
    31.         string shellScript = "chmod a+x \"$PROJECT_DIR/MapFileParser.sh\"";
    32.         pbxProject.InsertShellScriptBuildPhase(index, targetGUID, name, shellPath, shellScript);
    33.         pbxProject.WriteToFile(projectPath);
    34.  
    35.         Debug.Log("<color=green>iOS Build Permission Fix</color> Applied to XcodeProject");
    36.     }
    37. #endif
    38. }
    39.  
    The key thing is that this needs to be applied to the Unity Framework Target Build Phases, not the Unity-iPhone one. Shown in orange below is the Run Script that tries to execute MapParser.sh, it would be nice if Unity could just add the chmod command themselves to that Run Script build phase

    upload_2021-5-21_11-56-25.png
     

    Attached Files:

    GearedSun likes this.
  49. khanhabib

    khanhabib

    Joined:
    Oct 11, 2018
    Posts:
    29
    plz help!
    i am getting this error

    /Users/Arno/Library/Developer/Xcode/DerivedData/Unity-iPhone-bvktsxkdtsxzvdakehktvfqcltvp/Build/Intermediates.noindex/Unity-iPhone.build/ReleaseForRunning-iphoneos/UnityFramework.build/Script-9D3DC87A221D90AB00B2960B.sh: line 2: /Users/Arno/Downloads/XCode/MapFileParser.sh: Permission denied
     
  50. unity_UkbOpVV07NP2_g

    unity_UkbOpVV07NP2_g

    Joined:
    Feb 27, 2021
    Posts:
    6
    #Unarchiever was the key :D THANK YOU SO MUCH :))))))
     
    manlymooning likes this.