Running `make -j` hangs and prevents other processes from running on MacOS inside of kitty

I tried compiling ocaml/ocaml, but compiling hangs on running ocaml doc.

Once it hangs, macOS will behave very weirdly with processes not being able to start. The only solution I have found once entering this state is to reboot.

I have found 3 workarounds:

(yes this is extremely weird)

Could it be that you’re simply swapping to disk?

Have you monitored the output of ˋtop’?

MacOS is UNIX (or at least, that’s where it began), so this is … disturbing.

  1. when you say make -j, do you mean literally that command? B/c one would think that, yeah (per @benjamin-thomas ) you might get swapping, but that wouldn’t cause a hang.

  2. you said make -j 8 prevents the problem. Can you try make -j 16, and higher powers of 2, to see whether it’s literally make -j, or just a very high concurrency ?

  3. just in order to further confine the issue of the terminal emulator, can you run the make command under nohup ? That should disconnect it from the terminal ?

  4. and for good measure, nohup make -j < /dev/null &

Adding even more context on this (genuinely!) fascinating macOS issue. Having run ./configure --disable-stdlib-manpages && make -j (which succeeds), it was repeatably the case that make -j manpages would fail. Most of the time it was possible to abort make with CTRL+C which would reveal that every single ocamldoc.opt invocation for the generating the stdlib manpages was hanging. And then everything gets weird - apps wouldn’t start, the C could be invoked, but programs emitted by clang simply did nothing!

There doesn’t seem to be any swapping (nor a high memory usage).

It fails for high values of make -j <value>. It has both failed and succeeded at -j96.

Nohup doesn’t change anything. It still fails in kitty but doesn’t fail in alacritty. (even though the process doesn’t even output to the terminal anymore). Same if running nohup make -j < /dev/null & disown

The only thing that springs to mind would be to do a SMART check on your disk?

Then verify the integrity of your file system?

On a Linux host, I could see myself launching a live USB (OS running on a USB key) to validate or invalidate a hardware/software issue.

But it looks like your options are quite limited with Apple gear unfortunately

I had already managed to compile with the foot terminal emulator on Linux but just in case it was caused just by kitty I tried on kitty on Linux (using Asahi linux) and it worked (not particularly surprising… although who knows at this point…).

There are other projects that almost-certainly have high concurrency in their builds Like GCC, or Emacs. Have you tried to build such other projects with “make -j” (or “make -j 512”) to see if they cause problems ? [In the spirit of exonerating the innocent to incriminate the guilty]

Also, have you had an success asking in MacOS forums?

ETA: and also in kitty forums ?