Starting the REPL

Marcin Kasperski edited this page Nov 1, 2015 · 9 revisions

Go to Firefox Tools menu (to make it visible, press F10 or Alt-T – depening on your platform) and select MozLabStart MozRepl. MozRepl is now listening for connections on the default port 4242. Alternatively, use separate Firefox instance as described below in chapter Starting on specific port.

See platform notes below for how to start Firefox using the REPL addon.

Open the command shell of your operating system and type:


    telnet localhost 4242

You’ll be presented with the prompt:


    repl>

You’re in!

Platform-specific notes

If you’re using Microsoft’s telnet for Windows, it’s probably set to handle one-character-at-a-time instead of one-line-at-a-time. See the Troubleshooting page, or just use netcat (recommended) or putty.

If you’re on Linux or some other Unix variant, you can use rlwrap to get command history and other niceties. Use arrow-up/down to retrieve previous commands and Control+R to search among them.


    $ rlwrap telnet localhost 4242

If you’re using Emacs, see the Emacs integration page.

Starting on a specific port

To start the repl via the command line on a specific port, execute the following command depending on your platform.

OSX

/Applications/Firefox.app/Contents/MacOS/firefox -profile /path/to/profile/folder -repl -repl 7070
Linux
/usr/bin/firefox -profile /path/to/profile/folder -repl -repl 7070
Windows
"C:\Program Files (x86)\Mozilla Firefox\firefox.exe" /repl /repl 4242

The profile path in the examples above must be a profile that has the mozrepl extension installed.