xAct on Apple M2

637 views
Skip to first unread message

Thomas M

unread,
Aug 1, 2022, 9:33:15 AM8/1/22
to xAct Tensor Computer Algebra
Hi,

after having used xAct on an Intel Mac for some time, I am now migrating to an Apple M2 machine. However, I cannot seem to get xAct working, neither on Mathematica 12.3.1.0 nor 13.1.0.0.

If I copy the unpacked xAct directory (tried both 1.1.5 and 1.2.0) to `~/Library/Mathematica/Applications` and try to run xAct, the startup hangs after the message `Connecting to external mac executable...`.

I have also tried to compile xAct, essentially following the instructions at `http://xact.es/download/Mac_install` (with `mprep` and `mcc` located in `/Applications/Mathematica1.app/Contents/SystemFiles/Links/MathLink/DeveloperKit/MacOSX-ARM64/CompilerAdditions`), but this produces errors such as
`ld: warning: The i386 architecture is deprecated for macOS (remove from the Xcode build setting: ARCHS)`
and
`ld: symbol(s) not found for architecture i386`

I would be grateful for any kind of help to get xAct running!

Cheers,
Thomas

Thomas M

unread,
Aug 3, 2022, 3:43:02 AM8/3/22
to xAct Tensor Computer Algebra
In case anyone else is having similar issues on Apple Silicon: I have found a workaround solution.

Currently, it seems that the file xAct/xPerm/mathlink/xperm.mac is not compatible with Apple Silicon chips.
This can be seen by starting Mathematica via the Terminal and trying to start xAct: one obtains the error messagesh: ~/Library/Mathematica/Applications/xAct//xPerm/mathlink/xperm.mac: Bad CPU type in executable.

The program can thus be executed only via Rosetta 2, which can be installed via
softwareupdate --install-rosetta
(Also, be sure to follow the instructions of https://groups.google.com/g/xact/c/II4nH1IMkxc/m/TP81gQjvAAAJ to remove code-signing error "Apple cannot check [the executable] for malicious software".)

With this, xAct also runs on the new Apple Silicon chips via emulation, for the time being.
Are there perhaps plans to compile a new version which runs natively?

With best regards,
Thomas

Hongwei Tan

unread,
Aug 6, 2022, 11:26:19 AM8/6/22
to xAct Tensor Computer Algebra
Yes, I have the same issue. It shows that one of the file does not work since to the safety iissue. 

Jie Jiang

unread,
Jun 24, 2023, 12:14:00 AM6/24/23
to xAct Tensor Computer Algebra
Thanks for pointing out this. My M1 MacBook Air do not install rosetta and I meet the same problem. My M1 iMac does not have this problem since it has installed rosetta. I don't want to install rosetta and hope to run xAct on the Apple Silicon natively.

Xiang Junyi

unread,
Dec 9, 2023, 4:43:32 AM12/9/23
to xAct Tensor Computer Algebra
Hi,

I have the same issue on M1 MacBook Air these days. I reinstalled the package but it didn't fix the issue.When using the xAct after reinstall computer gave me the safety warning about xPerm.mac. It fixed the issue as I gave the permission to open that file.

I wonder how this issue occurs. The package worked very good before December and it suddenly became disfunctioning and the message "Connecting to external mac executable..." appeared. 

Best wishes,
Xiang

Leo Stein

unread,
May 16, 2024, 5:56:50 PM5/16/24
to Xiang Junyi, xAct Tensor Computer Algebra
Somebody needs to recompile xperm on a mac with a compiler that will generate both arm and x86 code into a universal binary. I attempted this but the code for xperm.c makes extensive use of a gcc extension — variable-length arrays (meaning something like `int L[n];` where `n` is only known at runtime) — but clang does not support this extension (and never will). If xperm.c is rewritten to avoid this extension, I think I could compile a 'universal' mac binary. It's not as simple as saying "just compile it with gcc" because Mathematica's script mcc defaults to searching for clang on the PATH before searching for gcc, so to compile it with gcc would involve hacking the mcc script.

--
You received this message because you are subscribed to the Google Groups "xAct Tensor Computer Algebra" group.
To unsubscribe from this group and stop receiving emails from it, send an email to xact+uns...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/xact/2c1828cf-89bb-4ca3-865f-4eafc4612e2an%40googlegroups.com.

Kasper Peeters

unread,
May 17, 2024, 4:52:07 AM5/17/24
to xAct Tensor Computer Algebra
For the purpose of using it in Cadabra (https://cadabra.science), I changed xperm.c some time ago to make use of dynamically allocated arrays instead of variable-length ones. I used a few C++ things to make this easy (essentially using a class instead of a struct for some data, in order to be able to use a constructor/destructor to handle allocation), but it's a fairly minimal change. I can't remember if I ever fed this back to Jose...

My version is can be found at https://github.com/kpeeters/cadabra2/blob/master/core/modules/xperm_new.cc. I don't know if many changes have been made to the original xperm.c since then, but it should be relatively easy to use my version as a guideline. In any case, it builds with clang just fine.

Thanks,
Kasper

Thomas Bäckdahl

unread,
May 17, 2024, 5:06:01 AM5/17/24
to xa...@googlegroups.com
Hi!

The version by Kasper does not contain the functions I implemented in 2014 used in the SymManipulator package.
These functions are stab_chain, one_orbit_chain, one_schreier_orbit_chain, conjugate_chain, basechange_chain, appendbasepoint_chain, interchange_chain.

Unfortunately, I don't have time to re-implement them to use more modern memory allocation standards at the moment. If someone wants to have a go at it, feel free to do so.

Regards
Thomas
--
You received this message because you are subscribed to the Google Groups "xAct Tensor Computer Algebra" group.
To unsubscribe from this group and stop receiving emails from it, send an email to xact+uns...@googlegroups.com.

Alfonso García-Parrado Gómez-Lobo

unread,
May 18, 2024, 2:24:13 AM5/18/24
to Leo Stein, Xiang Junyi, xAct Tensor Computer Algebra
Dear xAct users,

in the following repo

https://github.com/wtbgagoa/xpermLibraryLink

you can find xperm binaries (shared libraries) for different platforms
and instructions about how to make them work in your system. 
The source code is also available in case the available binaries do not
work for you. I hope this is useful.

Regards,

Alfonso García-Parrado.

Michael Seifert

unread,
Aug 28, 2025, 11:41:06 AM (11 days ago) Aug 28
to xAct Tensor Computer Algebra
One can, if one wishes, remove the "quarantine" attribute from the current version of xPerm.mac after installation, via the Terminal command

xattr -d com.apple.quarantine [path]/xAct/xPerm/mathlink/xperm.mac

where [path] is the location xAct is installed.  The package will then run without a problem (or at least it does on my M1 machine under Sequoia.)

This does defeat Apple's default security measures, which is not really best practices. Hopefully this will be addressed in the upcoming 14.3–compatible version that was announced recently.
Reply all
Reply to author
Forward
0 new messages