Version 7 of Apple Macintosh and Tcl/Tk

Updated 2002-01-29 17:15:29

Purpose: Accumulate tidbits and pointers to info about the use of Tcl and Tk on the Macintosh.


  • How do I mark MacOS Tcl scripts so that they run when clicked?

LV: A recent posting [L1 ] by Melissa Schrumpf goes into a lot of detail about this topic - read over it!


Q: How do I install Tcl related packages (extensions, etc.) on the Macintosh?


Q: On what versions of Mac hardware and software does Tcl run?


Q: How do I run Tcl/Tk on the Macintosh?

A: There are several alternatives. The source code for Tcl and Tk can be found at their SourceForge projects (see the Tcl Core Team page). This option requires you to know about Compiling Tcl on a Mac.

Another option would be to download the binary distributions.

Yet another option would be to download a Tclkit for the Macintosh - however, I don't know whether this is the latest Tcl and Tk or not.


Q: Can I run popular Tcl and Tk applications on the Mac?

A: Probably not without some modifications. Often writers of applications do so without realizing some of the cross platform issues required to be taken into consideration. What should I be sure to do so my Tcl based programs run cross platform?


mailto:[email protected] wrote in comp.lang.tcl :

Here are a couple of AppleScripts that may help speed up the edit/run cycle ( at least for small scripts...). My intent is to quickly send a script to "Wish" from BBEdit or Alpha. The following scripts will send the contents of the front window of BBEdit or Alpha to the Application wish.

For BBEdit ( I am using 6.0.1...) place the following script into the Scripts folder in BBEdit support. I named the script: "Send Script to Wish" and saved it as an application.

 --Get the contents of the front BBEdit Window

 tell application "BBEdit 6.0"
        set theFile to contents of text window 1
 end tell

 -- Give the contents to Wish

 tell application "Wish"
        activate
        do script theFile
 end tell

For Alpha I had to install OSA Menu ( a nifty tool) and installed the following script in the Folder Alpha Scripts in the Scripts folder of the System Folder. Again I saved the script as an application named "Send Script to Wish"

 tell application "Alpha"
        set theFile to DoScript "getText [minPos] [maxPos]"
 end tell

 -- now send the script to wish...
 tell application "Wish"
        activate
        set myResult to do script theFile
 end tell

Scripts without errors work fine, seems like I should be able to do a bit more with "bad" scripts...


The Tcl menu in Alpha contains a bunch of commands which can do all this sort of thing for you. Also if you activate the Remote Tcl Shell package, you can use Alpha as a command-line shell (i.e. a console) for Wish.

The items in the Tcl menu are of two types:

'evaluate remotely' -- if this flag is set, you can send the contents of the current window to Wish by simply selecting all (cmd-A) followed by evaluate (cmd-L). Similarly with any code-snippet.

Also you can 'execute command', and 'execute file in remote shell'. (note that this section on the Tcl menu in Alpha also applies to the Tcl menu in Alphatk should also work on Windows, Unix).


Note from mailto:[email protected] Installing Mac Tcl/Tk 8.3.2 will replace the Tool Command Language folder in the Extensions folder with an alias to a folder in the installation directory. Unfortunately this will probably break older applications (such as SpecTcl 1.1)which is compiled to use a 8.0 library. SpecTcl can be "recovered" by the following procedure.

  1. Drag the Tool Command Language alias out of the system folder.
  2. Run the SpecTcl 1.1 installer, this will create a new TCL folder
  3. Copy the contents of the new TCL folder to the folder pointed to by the alias TCL folder.
  4. Remove the just created TCL folder.
  5. Put the TCL alias back into the Extensions Folder.

SpecTcl should now run...

(this problem is fixed in Mac Tcl/Tk installers 8.3.3 and later. [ Daniel Steffen ])


Note from mailto:[email protected]

Visual TCL, a GUI editor written in "Pure TCL" is broken in Mac TCL/Tk 8.3.1-2. An error is thrown when you try to save a file. The problem appears to be caused by the non recognition of the "-filetypes" switch on the "tk_getSaveFile" command. To the best of my knowledge this occurs only one time in the source (all in tcl!) Carefully edit out the occurrence of this option and this particular problem will go away.

(this problem is fixed in Mac Tcl/Tk 8.3.3 and later. [ Daniel Steffen ])


MacTcl mailing list: http://lists.sourceforge.net/lists/listinfo/tcl-mac


See also Compiling Tcl on a Mac - Arts and Crafts of Tcl-Tk Programming - http://dev.scriptics.com/software/mac - http://www.maths.mq.edu.au/~steffen/tcltk/