Installing Tcl locally

Learn how to install Tcl locally to solve Exercism's exercises on your own machine

Installing tclsh

The only tool you need is the TCL interpreter, tclsh.

You will need tclsh8.4 or greater for the test framework, tcltest, to ship along with it. You can test which version of tclsh you have installed by running the following command:

tclsh <<< 'puts [info patchlevel]'

For Windows, the best place to get Tcl is the ActiveTcl product from ActiveState

For MacOS and Unix-like operating systems, tclsh will be already installed. Typically the installed version will be 8.5.something. To install the current stable 8.6 version:

Using the interactive tclsh shell

It's common to launch an interactive tclsh session to test out commands while you're coding. However, tclsh provides only a very basic REPL interpreter with no command line editing or command history. To add those, a program called rlwrap exists that adds readline functionality:

rlwrap tclsh

To install:

It's so handy you'll want to always use it: add this to your ~/.bashrc

command -v rlwrap && alias tclsh='rlwrap tclsh'