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.

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:

For solving exercises using the Exercism web interface, the test runner (as of Feb 2023) uses Tcl version 8.7a4.

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. For an enhanced experience, 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'

What version to use?

The current stable version is 8.6. As indicated above, version 8.5 is still widely deployed, but it's no longer receiving patches. Version 8.7 is still pre-release, but it's very stable.

You can test which version of tclsh you have installed by running the following command:

echo 'puts [info patchlevel]' | tclsh