This is documentation for Mathematica 5, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)

Documentation / Mathematica / The Mathematica Book / Principles of Mathematica / MathLink and External Program Communication /

2.13.10 Special Topic: Running Programs on Remote Computers

MathLink allows you to call an external program from within Mathematica even when that program is running on a remote computer. Typically, you need to start the program directly from the operating system on the remote computer. But then you can connect to it using commands within your Mathematica session.

Operating system on

This starts the program fprog and tells it to create a new link.

fprog -linkcreate

The program responds with the specification of the link it has created.

Link created on:

Mathematica session on

This connects to the link that has been created.


Out[1]=LinkObject[, 1]

This now executes code in the external program on



External programs that are created using mcc or mprep always contain the code that is needed to set up MathLink connections. If you start such programs directly from your operating system, they will prompt you to specify what kind of connection you want. Alternatively, if your operating system supports it, you can also give this information as a command-line argument to the external program.

Running an external program on a remote computer.