Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

If I enter

MathKernel -noprompt -run 'ToExpression["1", TeXForm]; Exit[]'

the kernel hangs, apparently while running TeX.exe as a mathlink (see below). But when I remove -noprompt, it runs just fine. Similar results hold if I pass these commands (to either MathKernel or MathematicaScript) as a script.

Alternatively, even with -noprompt, any of the other formats accepted by ToExpression work just fine.

Any ideas why this happens?

Rather than printing the output, I could just write to file and send all the prompt garbage to /dev/null, but this really doesn't fit into my tool chain very well. So I'd appreciate any solutions or workarounds. I'm running Mathematica 9.0 for Mac OS X x86 (64-bit) on OS X 10.6.8.

My evidence for believing that it's TeX.exe causing the problem is that my processes look like this

2772 s000  S+     0:00.28 /Applications/Local/ -noprompt -run Print[ToExpression["1", TeXForm]];Exit[]
2773 s000  S+     0:00.04 /Applications/Local/ -ml -mathlink -linkmode connect -linkprotocol SharedMemory -linkname jv5_shm

Now, without -noprompt, I also see TeX.exe in the process list with the exact same arguments. But it's only there briefly, and it returns normally. Also, I can run file TeX.exe, and see that it is indeed a Mac executable (not Windows, as the name would suggest).

share|improve this question
The name of TeX.exe is the same on all platforms, but it doesn't mean that it's invalid or unused on Mac or Linux. I can reproduce the problem on OS X 10.8 too. – Szabolcs Oct 1 '13 at 23:06
A workaround is to put the commands in a text file (file.m) and run it using math -script file.m – Szabolcs Oct 1 '13 at 23:07

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.