Terminal Vs. X11

Discussion in 'Mac Apps and Mac App Store' started by mowogg, Dec 1, 2004.

  1. mowogg macrumors 6502

    mowogg

    Joined:
    Mar 10, 2004
    Location:
    San Gabriel, CA
    #1
    Would someone be so kind as to explain the difference between the Terminal app and X11?
    I have used Terminal for various system clean-up commands (then I found Cocktail!) and use X11 to play GNUBG backgammon, but I don't understand why I need X11 to run GNU programs rather than Terminal.

    TIA,
    Rob
     
  2. jeremy.king macrumors 603

    jeremy.king

    Joined:
    Jul 23, 2002
    Location:
    Fuquay Varina, NC
    #2
    X11 is a windowing system that allows you to run GUI apps that weren't originally developed for OS X.

    Terminal is just a command line interface to your computer.
     
  3. mowogg thread starter macrumors 6502

    mowogg

    Joined:
    Mar 10, 2004
    Location:
    San Gabriel, CA
    #3
    Ah ha

    So X11 allows OS X to run GUI apps and the Terminal just runs UNIX apps that do not have a GUI front-end?
    That makes sense.
    Can X11 launch Linux apps or only Unix? Sorry for the dumb questions, I'm trying to figure out the whole "nix" thing.

    Thanks!
    Rob
     
  4. Westside guy macrumors 601

    Westside guy

    Joined:
    Oct 15, 2003
    Location:
    The soggy side of the Pacific NW
    #4
    The terminal lets you launch all *nix apps, whether they have GUI front ends or not. If the particular app uses an X11 GUI front end, then it will show up after you've typed the name of the app - assuming you've got X11 running (and, if it's on a remote machine, you're forwarding X11 via SSH or something like that).

    Here's a good test case for you. Make sure you've got X11 running on your mac. Open up terminal and type "xeyes" (don't type the quotes). That'll run a simple X11 app for you.
     
  5. broken_keyboard macrumors 65816

    broken_keyboard

    Joined:
    Apr 19, 2004
    Location:
    Secret Moon base
    #5
    X11 is a GUI server. If you run a web server on your computer then programs (Safari etc) can connect to your computer and ask for web pages. Likewise with X11, except instead of requesting web pages programs request that it display windows, buttons, menus for them on the local monitor.
     
  6. kylos macrumors 6502a

    kylos

    Joined:
    Nov 8, 2002
    Location:
    MI
    #6
    You mean x11 terminal, right? Anyway, I just tested it using the terminal app in the utilities folder. I tried x11 forwarding over ssh in both standard terminal and x11 terminal. x11 ran a windowed emacs, standard didn't. As far as xeyes, I had to type /usr/x11r6/bin/xeyes to run it and was then greeted with the error "Can't open display". Obviously, x11 terminal didn't have a problem. You have something set up to allow the standard terminal to run apps through x11?
     
  7. mattroberts macrumors regular

    mattroberts

    Joined:
    Oct 25, 2003
    Location:
    Canada
    #7
    Slightly off topic : but are there any good websites out there where i could get a better handle on using unix and X11 programs with MacOS (ie installing them, using them etc.) other then openoffice i have little to no experience with any x11/unix stuff on the mac.

    cheers
    m
     
  8. mowogg thread starter macrumors 6502

    mowogg

    Joined:
    Mar 10, 2004
    Location:
    San Gabriel, CA
    #8
    X11 Stuff

    Check out fink and fink commander. You can find them on Versiontracker. I know nothing about nix apps (12 years of Mac!) but these have allowed me to use some of this software.
     
  9. mowogg thread starter macrumors 6502

    mowogg

    Joined:
    Mar 10, 2004
    Location:
    San Gabriel, CA
    #9
    xeyes. Riot, riot!

    Thanks.
     
  10. Westside guy macrumors 601

    Westside guy

    Joined:
    Oct 15, 2003
    Location:
    The soggy side of the Pacific NW
    #10
    Oh, shoot - I forgot that the DISPLAY variable isn't set by default. I have mine set in my .bashrc file. Sorry about that.

    I'm not sure what "x11 terminal" is; I use iTerm myself. But regular old terminal should launch X11 apps if the DISPLAY variable is set, like so:

    Code:
    export DISPLAY=":0.0"
     
  11. kylos macrumors 6502a

    kylos

    Joined:
    Nov 8, 2002
    Location:
    MI
    #11
    terminal window associated with apple's x11 is what I'm referring to. Though it would be interesting that apple's terminal app and their x11 terminal have differering associated files. I'll have to check into this a bit more.
     
  12. Westside guy macrumors 601

    Westside guy

    Joined:
    Oct 15, 2003
    Location:
    The soggy side of the Pacific NW
    #12
    Little stuff like that are things I've had to adjust to, coming over from Linux to OS X. Since X11 isn't the main windowing system on OS X (and isn't installed by default), they don't set the DISPLAY variable, don't have X11 forwarding turned on in SSH by default, etc. I'd also forgotten that launching X11 launches an instance of xterm - I'd disabled that since I prefer iTerm or even Terminal over xterm. :D

    These are small annoyances, but it makes perfect sense given the circumstances - and they are easy to remedy.

    I think you'll find that Terminal.app and xterm aren't using "differing associated files" (to borrow your phrase). What's happening is this: When you launch X11.app, it sets the environment variable DISPLAY. Then when xterm launches from X11.app, it also has DISPLAY set since it inherits its environment from its parent (X11.app). Terminal.app just doesn't have DISPLAY set by default.

    You can check if DISPLAY is set by typing "echo $DISPLAY" at the command prompt. If it's not set you'll just get a blank line in response. Setting it to the right value is just a matter of typing the line in that I'd put in my previous post, or adding that to a file such as .bashrc in your home directory. The weird stuff at the end of that line (":0.0") tells X11 to use the main display on your local computer. It probably seems unnecessary that you have to actually say "use my main display", but X11 was designed as a network-accessible windowing system; theoretically you can set DISPLAY to point to a different machine's monitor screen or other output device just by changing those numbers - however I guarantee that won't work for various reasons, mostly having to do with security (I imagine that's pretty much self-evident).
     
  13. kylos macrumors 6502a

    kylos

    Joined:
    Nov 8, 2002
    Location:
    MI
    #13
    Ok, makes sense now. As for those "differing associated files" i was referring to .bashrc .bash-profile .bash-history etc. :D I've been messing around with x11 forwarding in ssh recently. We were messing with the DISPLAY variable etc. trying to run apps from his linux machine on my mac. Finally just tried adding the -X flag to the ssh command, and I was running a starcraft map editor on my mac using x11 through wine emulation in no time. :D Great fun. (Doing this from xterm, won't have to anymore)

    Thanks for the explanation, I'll be tweaking a few more settings in the days to come.
     
  14. daveL macrumors 68020

    daveL

    Joined:
    Jun 18, 2003
    Location:
    Montana
    #14
    Look into Darwin ports project. Also, macdevcenter.com
     

Share This Page