in reply to X11 emulation on mac OS

The OS X Tk (the Perl module) is probably compiling against the *NIX-y Tk (the Tcl extension) which is going to try and talk to an X server. There may be an OS X "native" (in that it's talking via Carbon or Cocoa rather than going through an X server) Tk version, but I'm not aware of such a beast. Given that X11.app is not installed by default but it does ship on the OS installation media, you need to consider if having one easily fulfilled dependency is worth the unknown hassle of getting the (possibly non-existent) native Tk going.

Replies are listed 'Best First'.
Re^2: X11 emulation on mac OS
by merlyn (Sage) on Apr 18, 2007 at 14:34 UTC
    Yes, OSX (at least 10.4) ships with a native Tk implementation, and the Perl Tk modules compiled against that. No need to fire up X11. (I rarely launch X11 on my mac.)
    update: Apparently, the built-in Perl does not have the Tk modules. However, TCL/TK is indeed native, and doesn't use X11. I'm not sure how you would build Perl-Tk against the native Tk Widgets, since Perl-Tk includes its own standalone copy of Tk.
      ahh...that might be the issue. I'm actually using active states version of perl because the standard distibution on 10.4 was 5.8.6. Can I simply recompile the activestates version of Tk? Thanks

        Well what do you know, I had Tk (the Tcl extension) lying around installed from Fink (which is really weird since I switched to darwinmacports a while ago . . .). Clobbered that one and what do you know there's a /usr/bin/wish and what looks like corresponding libraries and includes under /usr/{include,lib}. Make sure you don't have any other copies of Tk (the Tcl extension) lying around and then you should be able to reinstall Tk (the Perl module) and it should compile against the native Cocoa/Carbon-y copy.

        (And thanks for pointing that out merlyn. I didn't know that shipped with OS X :)

      Thanks merlyn, I have a question a bit off topic but as fletch pointed out I should be able to recompile Tk. Here's my question: I never removed the distibution of Perl that shipped with 10.4 I simply installed 5.8.8 from active state and set a s-link to the perl binary. Can I know just download Tk and build it as normal without relying on X11 or do I need to remove the existing version of Tk somehow.
      Thanks for the help!
      Assume I've made the apparent mistake of following Lidie's advice, http://www.lehigh.edu/~sol0/Macintosh/X/ptk/ # see END NOTE 1 for context of what Lidie wrote if the link is broken): I've downloaded from http://search.cpan.org/~ni-s/Tk-804.027/ and installed TK on my new OSX 10.4 mac mini. During the make test I see multiple failures of the following type: 'couldn't connect to display ":0" at /Tk-804.027/blib/lib/Tk/MainWindow.pm line 55.' because I didn't use X11 . R Schwartz wrote there is a native version of Tk already on my 10.4, that doesn't require the X11 . (Although I've got X11 installed from my disks, I honestly don't even know how to start this X11 consolre either) If this is correct, where do I, and how do I use this X11 free TK? when I attempted my first simple perl file with "use TK;" prior to my incomplete attempt to properly download, make and test the CPAN TK-804... I had a failure with that script because the OS10.4 perl didn't have a TK module available. Summarizing: Where and how do I use the native version of the Tk on the 0SX 10.4 ? If you can, please provide specifics and details. thanks, JB END NOTE 1 Lidie wrote: Perl/Tk and Mac OS X 10.4 (Tiger) You can use the Perl 5.8.6 that comes with Tiger or build it yourself. Now fetch the Perl/Tk distribution, (Tk-804.027)(http://search.cpan.org/~ni-s/Tk-804.027/) . Unpack Perl/Tk and build it using the standard idiom: tar -zxvpf Tk-804.027.tar.gz cd Tk-804.027 perl Makefile.PL make make test # here is where I have the issue where this test fails. sudo make install
        For example: The use Tk; creates the following error: Can't locate Tk.pm in @INC (@INC contains: /System/Library/Perl/5.8.6/darwin-thread-multi-2level /System/Library/Perl/5.8.6 /Library/Perl/5.8.6/darwin-thread-multi-2level /Library/Perl/5.8.6 /Library/Perl /Network/Library/Perl/5.8.6/darwin-thread-multi-2level /Network/Library/Perl/5.8.6 /Network/Library/Perl /System/Library/Perl/Extras/5.8.6/darwin-thread-multi-2level /System/Library/Perl/Extras/5.8.6 /Library/Perl/5.8.1 .) at tk.pl line 3. BEGIN failed--compilation aborted at tk.pl line 3.
        Addtionally if I attempt to use Tcl::Tk the following occurs:

        $ perl tcl.pl

        Can't locate Tcl/Tk.pm in @INC (@INC contains: /System/Library/Perl/5.8.6/darwin-thread-multi-2level /System/Library/Perl/5.8.6 /Library/Perl/5.8.6/darwin-thread-multi-2level /Library/Perl/5.8.6 /Library/Perl /Network/Library/Perl/5.8.6/darwin-thread-multi-2level /Network/Library/Perl/5.8.6 /Network/Library/Perl /System/Library/Perl/Extras/5.8.6/darwin-thread-multi-2level /System/Library/Perl/Extras/5.8.6 /Library/Perl/5.8.1 .) at tcl.pl line 1.

        BEGIN failed--compilation aborted at tcl.pl line 1.

      please, if I am to use Tcl::Tk on OSX 10.4 rather than use::Tk (which needs to be run form X11 console?) What are the key steps?

      Summarizing: Where and how do I use the native version of the Tk on the 0SX 10.4 ?

      Assume I've made the apparent mistake of following Lidie's advice,

      http://www.lehigh.edu/~sol0/Macintosh/X/ptk/ # see END NOTE 1 for context of what Lidie wrote if the link is broken):

      I've downloaded from http://search.cpan.org/~ni-s/Tk-804.027/ and installed TK on my new OSX 10.4 mac mini. During the make test I see multiple failures of the following type:

      'couldn't connect to display ":0" at /Tk-804.027/blib/lib/Tk/MainWindow.pm line 55.' because I didn't use X11 .

      R Schwartz wrote there is a native version of Tk already on my 10.4, that doesn't require the X11 . (Although I've got X11 installed from my disks, I honestly don't even know how to start this X11 consolre either)

      If this is correct, where do I, and how do I use this X11 free TK? when I attempted my first simple perl file with "use TK;" prior to my incomplete attempt to properly download, make and test the CPAN TK-804... I had a failure with that script because the OS10.4 perl didn't have a TK module available. If you can, please provide specifics and details.

      thanks, JB

      END NOTE 1 Lidie wrote: Perl/Tk and Mac OS X 10.4 (Tiger) You can use the Perl 5.8.6 that comes with Tiger or build it yourself. Now fetch the Perl/Tk distribution, (Tk-804.027)(http://search.cpan.org/~ni-s/Tk-804.027/) . Unpack Perl/Tk and build it using the standard idiom: tar -zxvpf Tk-804.027.tar.gz cd Tk-804.027 perl Makefile.PL make make test # here is where I have the issue where this test fails. sudo make install

Re^2: X11 emulation on mac OS
by Anonymous Monk on Apr 18, 2007 at 14:17 UTC
    I realize that the X11 package is shipped with the media and I've installed it and it works fine, however I have several users that just want to simple run the app without having to install the pkg so I was hoping for another solution.