It finally worked on Mac OS

Well, you know, we have trying to find the bug for one week and here is finally something that works on Mac. If you merge it I can create the binary right away.