Version 18 of MacTcl

Updated 2002-03-02 15:07:20

MacTcl is the name the community has used over time for a version of Tcl that runs on MacOS operating systems.


The focus of this page is to provide pointers and brief tips on building Tcl/Tk (and extensions for it) on MacOS 7, 8, 9, and X.

For pointers on using Tcl on the Mac, including notes on installation of pre-built binaries, go to Apple Macintosh and Tcl/Tk instead.

For a quick overview of all Mac related pages on this wiki, try http://mini.net/tcl/mac


Key MacTcl resources on the web

Building MacTcl on OS X 10.1.3 using ProjectBuilder 1.1.1

(notes under construction, to be adjusted while I make progress -jcw)

Ok, here we go... Using ~/src for source code, and ~/pbout + ~/pbtmp for ProjectBuilder results and intermediates, respectively:

    cd ~
    mkdir src pbout pbtmp

Getting the latest source from SourceForge CVS as described by James Bonfield [L1 ] (hit <return> when asked for a password):

    cd src
    cvs -d:pserver:[email protected]:/cvsroot/tcl -z3 login
    cvs -d:pserver:[email protected]:/cvsroot/tcl -z3 co -r macosx-8-4-branch tcl
    cvs -d:pserver:[email protected]:/cvsroot/tktoolkit login
    cvs -d:pserver:[email protected]:/cvsroot/tktoolkit -z3 co -r macosx-8-4-branch tk

Start ProjectBuilder, which lives in /Developer/Applications/. If this is the first time it was started, it'll ask for the setup of the two directories listed above (pbout and pbtmp), else go to the "Project Builder", "Preferences", "Building" menu/tab and enter the two (absolute) pathnames. As Jim Ingham notes, this is required so that the Tk project will find the binaries of the Tcl project.

From PB, do "File", "Open" to open the src/tcl/macosx/Tcl.pbproj file. Click on the leftmost "hammer" to build the "Tcl From Scratch" target which should be showing in the top middle pop-up of the window. Time for coffee (if you have a PB/300 as I do)!

When this completes, the bottom left status will say something like "Build succeeded, 9 errors" (yah, well... just warnings, it seems).

Now, from PB, open the src/tk/macosx/Wish.pbproj file. You need to alter one setting:

  • click on the Targets vertical tab
  • select "Tk Library" in the top left targets pane
  • select the "Files & Build Phases" horizontal tab
  • at the bottom, section "Shell Script", set the "Run only when installing" checkmark to prevent PB from launching a non-existent BuildConfig script.

Then make sure "Wish Shell" is selected in the center pop-up menu, and again: click on the top left hammer icon and finish that coffee (FYI, this step takes a very long time).

Ouch... it doesn't work. I get an error because "BuildConfig" was not found:

  PhaseScriptExecution <Execution>/Users/jcw/pbtmp/Wish.build/TkLibrary.build/BPTag008-script.sh 
  === Script ===
  #!/bin/sh
  source buildConfig
  --- Output ---
  /Users/jcw/pbtmp/Wish.build/TkLibrary.build/BPTag008-script.sh: source: no such file or directory: buildConfig [2]

Does anyone have a suggestion where to go from here? -JCW'

MacOS X specifics

  • terminology: Carbon(ized), Cocoa, packages, Quartz, .dmg files, frameworks [explain, or better still: point to web pages]
  • dynamic libraries [explain Mach-O], "two-level names", pre-binding
  • Project Builder (Interface Builder, AppleScript Studio)
  • where things live in the file system
  • X-windows, Oroboros (sp?), rootless X windows
  • running in the Classic environment within MacOS X

The Mac Is Different

  • AppleScript
  • the lack of "exec" and pipes
  • socket differences
  • encoding
  • pathnames work differently (colons, but not in same place as slash)