Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

building Tcl/Tk on Mac OS X

246 views
Skip to first unread message

Brad Lanam

unread,
Oct 14, 2017, 11:43:02 AM10/14/17
to
I used the following to build on Mac OS X 10.12.6, but:

bll-mac:bll$ $HOME/local/usr/local/bin/tclsh8.6
% package require Tk
8.5.9

It picks up the system's Tk package.
Does anyone have a complete method to install Tcl/Tk to a local folder so that it works?

cd tcl8.6.7
make -C macosx clean
make -C maxosx INSTALL_ROOT=$HOME/local
cd tk8.6.7
make -C macosx clean
make -C maxosx INSTALL_ROOT=$HOME/local

# yes, I know I should be using @executable_path....
install_name_tool -change "/Library/Frameworks/Tcl.framework/Versions/8.6/Tcl" $HOME/local/Library/Frameworks/Tcl.framework/Versions/8.6/Tcl $HOME/local/usr/local/bin/tclsh8.6
install_name_tool -change "/Library/Frameworks/Tk.framework/Versions/8.6/Tk" $HOME/local/Library/Frameworks/Tk.framework/Versions/8.6/Tk /Users/bll/local/Library/Frameworks/Tk.framework/Versions/8.6/Resources/Wish.app/Contents/MacOS/Wish
install_name_tool -change "/Library/Frameworks/Tcl.framework/Versions/8.6/Tcl" $HOME/local/Library/Frameworks/Tcl.framework/Versions/8.6/Tcl /Users/bll/local/Library/Frameworks/Tk.framework/Versions/8.6/Resources/Wish.app/Contents/MacOS/Wish

Rolf Ade

unread,
Oct 14, 2017, 12:31:52 PM10/14/17
to

Brad Lanam <brad....@gmail.com> writes:
> I used the following to build on Mac OS X 10.12.6, but:
>
> bll-mac:bll$ $HOME/local/usr/local/bin/tclsh8.6
> % package require Tk
> 8.5.9
>
> It picks up the system's Tk package.
> Does anyone have a complete method to install Tcl/Tk to a local folder so that it works?

Paul Obermeier's BAWT worked pretty well for me on Mac. Builds not only
the core, but also several important extensions and a tclkit, in one go,
if you want.

http://www.bawt.tcl3d.org/index.html

Brad Lanam

unread,
Oct 14, 2017, 12:56:21 PM10/14/17
to
On Saturday, October 14, 2017 at 9:31:52 AM UTC-7, Rolf Ade wrote:
Thanks. I will probably take a look at it later.

Here's a working build script.

I still need to figure out a patch so that a 'package require Tk'
works properly. I know what needs to go in, have to figure out
where it needs to be defined.

#!/bin/bash

set -x

test -d build && rm -rf build

cd tcl8.6.7
make -C macosx clean
make -C macosx INSTALL_ROOT=$HOME/local install
cd ..

cd tk8.6.7
make -C macosx clean
make -C macosx INSTALL_ROOT=$HOME/local install
cd ..

chmod u+w $HOME/local/usr/local/bin/tclsh8.6
install_name_tool -change "/Library/Frameworks/Tcl.framework/Versions/8.6/Tcl" @executable_path/../../../Library/Frameworks/Tcl.framework/Versions/8.6/Tcl $HOME/local/usr/local/bin/tclsh8.6

chmod u+w $HOME/local/Library/Frameworks/Tk.framework/Versions/8.6/Resources/Wish.app/Contents/MacOS/Wish
install_name_tool -change "/Library/Frameworks/Tk.framework/Versions/8.6/Tk" @executable_path/../../../../Tk $HOME/local/Library/Frameworks/Tk.framework/Versions/8.6/Resources/Wish.app/Contents/MacOS/Wish
install_name_tool -change "/Library/Frameworks/Tcl.framework/Versions/8.6/Tcl" @executable_path/../../../../../../../Tcl.framework/Versions/8.6/Tcl $HOME/local/Library/Frameworks/Tk.framework/Versions/8.6/Resources/Wish.app/Contents/MacOS/Wish

Brad Lanam

unread,
Oct 14, 2017, 1:46:29 PM10/14/17
to
Maybe there's a better way, but this works to modify the auto_path so that
a 'package require Tk' works.

--- library/init.tcl-orig 2017-10-14 10:37:45.000000000 -0700
+++ library/init.tcl 2017-10-14 10:39:53.000000000 -0700
@@ -65,6 +65,15 @@
}
}

+ foreach Dir [list $::tcl_library [file dirname $::tcl_library]] {
+ if { [string match *Tcl.framework* $Dir] } {
+ regsub Tcl.framework $Dir Tk.framework Dir
+ if {$Dir ni $::auto_path} {
+ lappend ::auto_path $Dir
+ }
+ }
+ }
+
if {![interp issafe]} {
variable Path [encoding dirs]
set Dir [file join $::tcl_library encoding]

Robert

unread,
Oct 16, 2017, 11:07:06 AM10/16/17
to
On Saturday, October 14, 2017 at 11:43:02 AM UTC-4, Brad Lanam wrote:
> I used the following to build on Mac OS X 10.12.6, but:
>
> bll-mac:bll$ $HOME/local/usr/local/bin/tclsh8.6
> % package require Tk
> 8.5.9
>
> It picks up the system's Tk package.
> Does anyone have a complete method to install Tcl/Tk to a local folder so that it works?

Homebrew has a tcl-tk recipe that works. Maybe you can glean something from there:

https://github.com/Homebrew/homebrew-core/blob/master/Formula/tcl-tk.rb

--
Bob

Johan

unread,
Oct 17, 2017, 4:04:01 AM10/17/17
to
Also Macports (www.macports.org/ports.php) has a tcl and tk port.
Current version 8.6.

-- _____________________________________ Ing. Johan van Oostrum chaos
geordend - www.chaosgeordend.nl _____________________________________
0 new messages