Configure your system to evaluate external Ruby code.

For Mac...

Install Ruby

Information about how to download and install Ruby can be obtained from https://www.ruby-lang.org/en/documentation/installation.

Install the ZeroMQ package

Instructions for installing ZeroMQ on the Mac can be found at https://zeromq.org/download/#osx.

Install the ZeroMQ package for Ruby

Install the ZeroMQ package for Ruby using the Ruby package management framework, gem:

$ gem install ffi-rzmq

Verify the installation

If the installation was successful, FindExternalEvaluators will find it automatically:

  • If you have more than one version of Ruby installed on your machine, you can use RegisterExternalEvaluator to make a specific installation of Ruby the default.

Evaluate Ruby code

Use ExternalEvaluate with the Ruby installation to evaluate Ruby code:

Alternatively, use a Ruby code cell to evaluate Ruby code:

Math.sqrt(36)
  • If ExternalEvaluate fails, it is likely that the ZMQ package is not installed. Make sure you install the packages with the specific installation of Ruby that you would like to use.

For Windows...

Install Ruby

There is an installer for Windows that can be obtained from https://rubyinstaller.org. Information about how to download and install Ruby can be obtained from https://www.ruby-lang.org/en/documentation/installation.

Install ZeroMQ for Windows

Download and install ZeroMQ from http://wiki.zeromq.org/distro:microsoft-windows.

Rename the file C:\Program Files\ZeroMQ 4.0.4\bin\libzmq-v120-mt-4_0_4.dll to C:\Program Files\ZeroMQ 4.0.4\bin\libzmq.dll.

Add C:\Program Files\ZeroMQ 4.0.4\bin to your PATH environment variable. You will need to restart Mathematica to see the change.

Install the ZeroMQ package for Ruby

Install the ZeroMQ package for Ruby using the Ruby package management framework, gem:

> gem install ffi-rzmq

Verify the installation

If the installation was successful, FindExternalEvaluators will find it automatically:

  • If you have more than one version of Ruby installed on your machine, you can use RegisterExternalEvaluator to make a specific installation of Ruby the default.

Evaluate Ruby code

Use ExternalEvaluate with the Ruby installation to evaluate Ruby code:

Alternatively, use a Ruby code cell to evaluate Ruby code:

Math.sqrt(36)
  • If ExternalEvaluate fails, it is likely that the ZMQ package is not installed. Make sure you install the packages with the specific installation of Ruby that you would like to use.

For Linux...

Install Ruby

Information about how to download and install Ruby can be obtained from https://www.ruby-lang.org/en/documentation/installation.

Install the libzmq package

Install the ZeroMQ package as described in https://zeromq.org/download/#linux.

Install the ZeroMQ package for Ruby

Install the ZeroMQ package for Ruby as the current user, invoke the Ruby package management framework, gem:

$ gem --user install ffi-rzmq

To install for all users, do:

$ sudo gem install ffi-rzmq

Verify the installation

If the installation was successful, FindExternalEvaluators will find it automatically:

  • If you have more than one version of Ruby installed on your machine, you can use RegisterExternalEvaluator to make a specific installation of Ruby the default.

Evaluate Ruby code

Use ExternalEvaluate with the Ruby installation to evaluate Ruby code:

Alternatively, use a Ruby code cell to evaluate Ruby code:

Math.sqrt(36)
  • If ExternalEvaluate fails, it is likely that the ZMQ package is not installed. Make sure you install the packages with the specific installation of Ruby that you would like to use.