I'm running Mathematica 11 from command line on OS X El Capitan. As far as I know, I can only pass command line arguments using the wolframscript command. Here's my minimal working example:



I invoke it with e.g.

wolframscript -script try.wl 2

The script is executed correctly, but my OS switches the focus to a temporary Mathematica window - which basically does not even appear, but I can read Mathematica on my upper left corner and see the dot under the icon in the app dock.

This is all rather annoying for running in batch mode, as it interrupts everything else I'm doing. Any ideas?

Hint: the Export command seems to play some role. Adding ;s doesn't help.

  • 1
    $\begingroup$ I cannot reproduce this. It is true that Export will launch a front end process which has no windows but does show up in the dock. However, I cannot reproduce any focus switch. Perhaps I do not understand what you mean by focus switch. I can keep using another program while the script runs. Its window won't stop being the selected one. $\endgroup$ – Szabolcs Feb 1 '17 at 17:15
  • $\begingroup$ The behavior I experience is different: the selected window changes to Mathematica. That might be an OS problem more than a Mathematica one then, crap. It would however be nice to run Export without the need for the front end process, given that even Plot does not need it... $\endgroup$ – Lio Feb 1 '17 at 17:28
  • $\begingroup$ How can it focus the Mathematica window when the front end that is started has no visible windows whatsoever? Can you give step by step instructions to reproduce the problem? Restart your computer to start with a clean slate. Then describe what I should do, step by step, to trigger the problem. Describe what happens on your machine, and what you want to happen instead. $\endgroup$ – Szabolcs Feb 1 '17 at 17:54
  • $\begingroup$ The front end is necessary for all rendering and PDF generation. Plot involves no rendering (it just generates a Graphics expression), so it doesn't need a front end. Export, Rasterize, etc. do. $\endgroup$ – Szabolcs Feb 1 '17 at 17:54
  • $\begingroup$ @Szabolcs Clearly a subtle and stupid OS problem. After following your suggestions, I realised the issue is noticeable only when the terminal is run in full screen mode (I do have strange habits indeed). Can you reproduce this? $\endgroup$ – Lio Feb 1 '17 at 18:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.