Building Snack on Mac OS X
July 22, 2018 ยท View on GitHub
-
Download the Snack 2.2.10 source code and extract the file.
$ tar -xzf snack2.2.10.tar.gzThis command will extract all the source files into a
snack2.2.10folder. -
Follow the directions in the
snack2.2.10/mac/README, but with slightly different paths. Change to thesnack2.2.10/unixdirectory. Then run:$ ./configure --with-tcl=/System/Library/Frameworks/Tcl.framework --with-tk=/System/Library/Frameworks/Tk.frameworkNote that contrary to the README instructions, the correct path is
/System/Library/Frameworks/...and not/Library/Frameworks/.... (Thanks to this blog post for the correction.)Open
Makefileand note the 3rd and 7th lines in the makefile:TCL_INCPATH = /BuildRoot/Library/Caches/com.apple.xbs/Sources/tcl/tcl-118.50.1/tcl/tcl/generic TK_INCPATH = /BuildRoot/Library/Caches/com.apple.xbs/Sources/tcl/tcl-118.50.1/tk/tk/genericYou need to change
TCL_INCPATHto/System/Library/Frameworks/Tcl.framework/HeadersandTK_INCPATHto/System/Library/Frameworks/Tk.framework/HeadersYou can do this manually by opening up the file and typing in the paths.
Or you can do it on the command line by using sed:
$ sed -e '3s~.*~TCL_INCPATH = /System/Library/Frameworks/Tcl.framework/Headers~' -i '' Makefile $ sed -e '7s~.*~TK_INCPATH = /System/Library/Frameworks/Tk.framework/Headers~' -i '' Makefile(Here we are using
~as the delimiter in sed instead of/, since there are forward slashes/in the path name variable.) -
Now we can compile the Snack library using make.
$ makeIf you get the error
sed: RE error: illegal byte sequence, then try:$ export LC_CTYPE=C && export LANG=C && export LC_ALL=C && makeBuild the Snack library by running
$ sudo make installThe Snack library should be installed in
/lib/snack2.2.(Alternatively, you can install to a specific directory using
$ make DESTDIR=/path/to/directory install) -
Copy the Snack library to the folder where Tcl looks for packages. On Mac OS X High Sierra which uses Tcl8.5, this should be
/System/Library/Tcl/8.5.$ sudo cp -R /lib/snack2.2 /System/Library/Tcl/8.5(If you installed to a different directory, replace
/lib/snack2.2with the name of that directory.)Check that Tcl can find the Snack library, by running the Tclsh shell.
$ tclsh8.5 % package require snack % exitWhen you run the tclsh command
package require snack, it should output2.2if the Snack library has been installed correctly. If instead it outputcan't find package snack, then the install failed.If you are running a different version of Tcl (e.g. Tcl8.6), change the references to
8.5in the above to your version (e.g.8.6).