I would like to map Ctrl-U to "kill line" when using Mathematica 9.0 in command line mode (i.e. not within the front end, but when called from a Unix command line by "math").

I am aware that (on a Mac) the directory /Applications/Mathematica.app/SystemFiles/FrontEnd/TextResources/Macintosh contains the file "KeyEventTranslations.tr", however this file seems to only affect the front end, not the behavior of the kernel when called from the command line.

I also know that Ctrl-C and Ctrl-G are already mapped to "Kill line" (although they don't seem to have corresponding entries in "KeyEventTranslations.tr"). But I would prefer to use Ctrl-U since this is what I am using in all other applications. (Note: Ctrl-U used to work in Math 8.0).

  • $\begingroup$ possible duplicate of How do I efficiently navigate the command line interface to Mathematica? $\endgroup$
    – halirutan
    Aug 14, 2013 at 2:43
  • $\begingroup$ Please see my answer in the above link. This should help you. $\endgroup$
    – halirutan
    Aug 14, 2013 at 2:44
  • $\begingroup$ Hmm, it doesn't seem to work. Maybe one has to tweak rlwrap. At least you could have a look at this. $\endgroup$
    – halirutan
    Aug 14, 2013 at 2:52
  • $\begingroup$ Ditto. I just did port -install rlwrap and then rlwrap .../MathKernel, but the problem persists. But thanks for the idea. I'd rather fix it in Mathematica than tweak rlwrap. $\endgroup$
    – edgeloss
    Aug 14, 2013 at 2:54

1 Answer 1


According to a talk at the Wolfram Technical Conference last year, Mathematica 9's command-line interface now uses the GNU readline library. I believe that normally this library can be made to read its configuration settings from a file. However, in the talk (at about 23:00) he says that "currently they are hard coded, so it's a list of assignments, but ideally they should be read from a config file, so you should be able to reset to whatever you like." And on the screen it says "a user-defined config file is on TODO list." So my guess is that you are stuck with whatever he used until this is improved in a later version of Mathematica. If you really hate the new terminal input system (esp. on Windows, which already has its own superior keyboard editing support) you can get rid of it by deleting or renaming the file term.dll/libterm.so in SystemFiles/Kernel/Binaries/($SystemID).

  • 1
    $\begingroup$ GNU readline is supposed to read ~/.inputrc, but it does not seem to be read by Mathematica. Removing ...Kernel/.../libterm.* does seem to work: it kills the Mathematica input system completely, and leaves the original one inherited from the shell. $\endgroup$
    – edgeloss
    Aug 14, 2013 at 4:21

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.