I occasionally ssh into machines that have Mathematica installed. I then operate Mathematica through the command-line interface.

Often, the command-line interface isn't the ideal way to operate Mathematica, but it does have incredible convenience and speed advantages.

Is there a ncurses library (maybe even a 3rd party one) to add additional functionality when accessing Mathematica through ssh?


List of ideas for additional functionality

  1. Cursor clicking support, so I don't have to use the arrow keys
  2. Ability to rerun command (Shift+Enter)
  3. Support for Save As
  • $\begingroup$ My hunch is no, although you might get hopefully better answers than that or workarounds, if you explain what additional functionality you are looking for. If it's for plotting, there's an answer on this site on making ascii mathematica plots in the terminal $\endgroup$ – rm -rf Mar 19 '13 at 4:53
  • $\begingroup$ @rm-rf Ideally I would like to be able to rerun commands, similar to the notebook interface(Shift+Enter). Also cursor support to move to different locations would be ideal. I'm editing the question to add additional info. $\endgroup$ – William Mar 19 '13 at 4:57
  • $\begingroup$ I think you just need a readline wrapper for that, which will allow you to use the arrow keys for movement. That was also asked and answered. mathematica.stackexchange.com/q/11192/5 $\endgroup$ – rm -rf Mar 19 '13 at 5:05
  • $\begingroup$ I believe this, pages.uoregon.edu/noeckel/Mathematica.html might enable cursor support by using emacs to access mathematica through the command line $\endgroup$ – William Mar 19 '13 at 5:09
  • $\begingroup$ Yes indeed. You can launch emacs and do Esc-x shell. Then launch the Mathematica Kernel (usually with the command math). That's it. Now you can move up and down with the cursor and re-run commands. However, cursor clicking won't work unless you start an XWindow server (which costs you some of the speed advantages that a pure text terminal has). $\endgroup$ – Jens Mar 19 '13 at 5:30

I'll just show some screen shots of what it looks like when you run the Mathematica Kernel from within emacs in the Terminal on Mac OS X. This is the purely cursor-driven text terminal, no mouse support:

  • Start emacs
  • type EscxshellReturn
  • type math
  • start entering Mathematica commands, entering them with Shift-Return
  • Do some calculations and backtrack with the cursor:


  • press Shift-Return


  • backtrack with cursor:


  • press Shift-Return



You can also save this session as a file.

  • $\begingroup$ Do you mind trying? M-X xterm mouse mode My emacs keeps throwing an error( mine isn't compiled for mouse support currently), but I quiet curious to see if that enables mouse support for you $\endgroup$ – William Mar 19 '13 at 5:55
  • $\begingroup$ I can't get that to work either (in Terminal). But mouse support works perfectly fine within Aquamacs emacs (an OS X native emacs port I have installed). Anyway, the thing is that remote Xwindow connections are always so slow that I don't bother with them. $\endgroup$ – Jens Mar 19 '13 at 6:08
  • $\begingroup$ From Aquamacs emacs on my local machine, I can launch a remote connection and run math on the host. Then point and click works without having to start an XWindow session. $\endgroup$ – Jens Mar 19 '13 at 6:12

On Unix you can install rlwrap

 (~/)> rlwrap math

 Mathematica 8.0 for Mac OS X x86 (64-bit)
 Copyright 1988-2011 Wolfram Research, Inc.

In[1]:= 1+1

Out[1]= 2

it saves the commands, and you can use up-arrows to access previously typed commands.

  • $\begingroup$ This is what I pointed the OP to in the comments... if this is all there is to the question, then it is a dupe of the linked one. $\endgroup$ – rm -rf Mar 19 '13 at 18:02

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.