How do I get Lime working on my M1/M2 Macs?

Sorry to be that guy, but I’ve been trying to pull all the threads together to get it to work, but it just isn’t clicking.

I have the repo locally and can build the x86_64 versions with arch -x86_64 but running the Haxe project still fails with (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64').

Is there a definitive guide or some arm64/arm64e binaries around?

I personally recommend installing the Intel version of Haxe (just the standard Mac installer from https://haxe.org/download/), and then installing Lime from with haxelib install lime, at least to start out. Haxe and Lime run just fine in Rosetta, and I’ve been successfully using the Intel versions on M1 (and newer) Macs since 2021 with no issues.

Once you confirm thats working with a simple Hello World project, then you can try checking out the Lime repo and rebuilding manually (still on Intel Haxe). Lime can be tricky to build with all the native OS integration, so that’s why I suggested starting with an official release from Haxelib.

Finally, if you can get the Lime repo building for Intel, then you might try switching to Apple Silicon Haxe from wherever that’s available (Homebrew, I think?). I think we only recently started supporting Apple Silicon builds, so there might still be some rough edges, which is why I suggested building Lime for Intel first, just to get past any initial hurdles.

1 Like

It’s taken a little while, but I am a bit closer. I’m doing this on a slightly locked down machine; I can’t install the Haxe installer as it’s not signed. But I have installed x86 Homebrew and x86 Haxe from that.

I’ve installed the required libraries from haxelib, but when I go to run the setup commands, i get this error:

> haxelib run openfl setup
Could not link to neko.
Called from lime/_internal/backend/native/NativeCFFI.hx line 632
Called from lime/system/CFFI.hx line 177
Called from lime/system/CFFI.hx line 300
Uncaught exception - Segmentation fault

Neko is installed and available in the path.

I might have a crack at trying to build it and see if I can get some more info.

I think I read that Homebrew installs Neko in a non-default location, which leads to the Could not link to neko. error message.

In Lime 8.1, we added a new -eval option that completely bypasses Neko, and runs Lime’s tooling using the Haxe interpreter instead.

Try haxelib run openfl setup -eval

You may need to run with -eval for every Lime/OpenFL command after that too. So instead of openfl build html5, it would require openfl build html5 -eval. Not ideal, I know.

2 Likes

It’s working!

Thanks so much for your help :gift_heart:

Edit: Well, it’s getting closer.

> lime test html5 -eval
Experimental: executing `lime test html5` using Eval (https://haxe.org/blog/eval/)
Uncaught exception Null Access
tools/platforms/HTML5Platform.hx:506: characters 84-129 : Called from here
src/lime/tools/PlatformTarget.hx:105: characters 4-12 : Called from here
tools/CommandLineTools.hx:640: characters 5-42 : Called from here
tools/CommandLineTools.hx:125: characters 5-26 : Called from here
tools/CommandLineTools.hx:1903: characters 3-25 : Called from here

Also all the VS code tooling isn’t working. But baby steps; I’m testing building a macos build. I’ll investigate those errors later.

So I decided to try installing Haxe/Neko from Intel Homebrew on my Apple Silicon Mac, and get Lime/OpenFL to work without -eval. Unless there’s something I failed to delete somewhere that was from the old .pkg installer that is still being used under my nose, I think I did it.

First, I made sure that all versions of Haxe/Neko were completely removed, including both versions from Homebrew (don’t want to mix and match different architectures!), and the .pkg installer that I was originally using. I also removed the lime and openfl aliases, just to start as clean as possible. I ran the following commands:

/opt/homebrew/bin/brew uninstall haxe
/opt/homebrew/bin/brew uninstall neko
/usr/local/bin/brew uninstall haxe
/usr/local/bin/brew uninstall neko
sudo rm -rf /usr/local/lib/haxe
sudo rm -rf /usr/local/lib/neko
sudo rm /usr/local/bin/haxe
sudo rm /usr/local/bin/haxelib
sudo rm /usr/local/bin/neko
sudo rm /usr/local/bin/openfl
sudo rm /usr/local/bin/lime

Then, just to be sure, I confirmed that none of these commands were working anymore. They all correctly resulted in a command not found error in my terminal.

haxe
haxelib
neko
lime
openfl

Then, explicitly using Intel Homebrew, I installed Haxe on my Apple Silicon Mac with the following command:

/usr/local/bin/brew install haxe

I confirmed that the haxe and neko commands were working with basic default output and no errors.

haxe
neko

Then, I setup Haxelib, as required by Haxe:

haxelib setup

Then, I installed OpenFL and ran its setup command (without -eval)

haxelib install openfl
haxelib run openfl setup

Finally, I went to one of the OpenFL sample projects and ran openfl test html5. It worked! I also opened the project in VSCode, and code intelligence was working correctly.

2 Likes

:partying_face:

It’s working!
I think the main problem was that my x86 Homebrew wasn’t installed or setup properly. Wiping that (and nearly everything else) works!

Also, I went down the path of making a copy of iTerm2 that ran through Rosetta. that’s where I first got it working. But I just ran the NyanCat template form the normal version and it too worked.

1 Like

It works for me! I opened a terminal in Rosetta mode, did the install, switched back to ARM, and everything still works.
thanks,
joshtynjala