Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I would like to perfom such feats as cycling through previous commands, editing commands in place, etc. My expectation would be a readline-like interface, but this appears to not be the default.

share|improve this question
    
Just curious: Why would you use the command line? Even for remote kernels, working with a frontend would be possible. –  Sjoerd C. de Vries Sep 27 '12 at 19:48
    
@SjoerdC.deVries sometimes configuring remote access can be painful, especially over ssh. –  rcollyer Sep 27 '12 at 19:49
1  
you could also just use emacs as a frontend for mathematica (there are modes for that) –  acl Sep 27 '12 at 22:04
    
@acl there are modes for everything in emacs. –  rcollyer Sep 28 '12 at 1:30

2 Answers 2

up vote 24 down vote accepted

If you want readline-like behavior you can of course use a readline wrapper. This works on all operating systems. On Ubuntu Linux (and other distributions I'm sure too) it can be installed easily through the package management. On Max OSX this can be installed using for instance MacPorts and I'm sure, there is an easy option on Windows too. Anyway, on all systems you can compile it yourselft. The usage is then

rlwrap math 

on Linux or

rlwrap /Applications/Mathematica.app/Contents/MacOS/MathKernel 

on Mac OSX. Try it and be surprised ;-)

share|improve this answer
2  
Very cool! I didn't know about rlwrap (and I had the same experience as the OP when I tried the CLI out of curiosity). –  rm -rf Sep 27 '12 at 20:40
2  
@rm-rf sometimes I wonder whether it's because the most guys at Wolfram are Windows-guy. They really just give a <insert very rude word of your choice here> about the command line. –  halirutan Sep 27 '12 at 20:44
    
I used to use the kernel interface extensively, and for a while there, I got quite good at it. Of course, the notebook interface didn't exist when I started using mma, but that dates me a little to well, I think. –  rcollyer Sep 28 '12 at 1:34
    
@halirutan I'd assume that this is because most people use the notebook interface for daily work. Then the command line interface doesn't get much love. –  Renan Sep 28 '12 at 1:40
    
@halirutan: Thanks, I was able to build this from source and use it. –  intermath Sep 28 '12 at 16:33

If you're on Windows: which command line interface are you talking about?

The "math.exe" program is a console mode (i.e. "DOS prompt") interface to the Mathematica kernel. If you use that, you have access to the standard Windows console command-line editing; it is automatically provided by the OS to all console mode programs. You can use the arrow keys to move around in previous commands, and you can edit, insert, and delete, copy, cut and paste using the traditional DOS-style editing and function keys.

The "MathKernel.exe" program -- which is what appears as "Wolfram Mathematica 8 Kernel" in your Start Menu -- is a very simple GUI windowed interface without any line editing or other special features.

I usually use the Mathematica kernel by running "math.exe" inside a console, which I have set to be as tall as the screen and with a very large scrollback buffer (set using the console's "Properties" menu).

A LATER UPDATE: In Mathematica 9, the "math.exe" program uses a new and different keyboard editing system that it did before, one based on GNU readline. But you can get rid of that and go back to standard Windows console command-line editing by removing or renaming the file term.dll in $TopDirectory\SystemFiles\Kernel\Binaries\Windows (32 bit) or Windows-x86-64 (64 bit).

share|improve this answer

Your Answer

 
discard

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

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