Search code examples
c#dllunity-game-enginemonodevelop

mcs command not found when creating a DLL in mac develop unity3d


I follow this doc to create a dll file http://docs.unity3d.com/Manual/UsingDLL.html but the mcs command not found?

how to solve it?

I installed unity 4.5.1

I know this is the environment problem, so how to config the value in mac?

thank you!


Solution

  • Answer updated for OS X El Captain and Unity 5.2

    A usable mcs should be in /Applications/Unity/Unity.app/Contents/Frameworks/MonoBleedingEdge/bin/.

    It'll be easiest to add this dir to your $PATH, paste this in the terminal that you want to use (or to your startup scripts).

    PATH=$PATH:/Applications/Unity/Unity.app/Contents/Frameworks/MonoBleedingEdge/bin/
    

    You should then have a working msc command:

    $ mcs --version
    Mono C# compiler version 3.4.0.0
    

    For other Unity versions:

    Open a terminal and type find /Applications/Unity/ -name 'mcs' - this will give you a list of msc compilers in your unity installation, for example my list looks like this:

    /Applications/Unity/MonoDevelop.app/Contents/Frameworks/Mono.framework/Versions/2.10.12/bin/mcs
    /Applications/Unity/Unity.app/Contents/Frameworks/Mono/bin/mcs
    /Applications/Unity/Unity.app/Contents/Frameworks/MonoBleedingEdge/bin/mcs 
    

    Check if any of these runs and pick that one. For 5.2, only the last one works without fixing paths inside the mcs script.