Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

mowogg

macrumors 6502
Original poster
Mar 10, 2004
260
0
San Gabriel, CA
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
 
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.
 
Ah ha

kingjr3 said:
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.

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
 
mowogg said:
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.

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.
 
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.
 
Westside guy said:
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.

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?
 
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
 
X11 Stuff

mattroberts said:
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

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.
 
Westside guy said:
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.

xeyes. Riot, riot!

Thanks.
 
Kyle? said:
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?

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"
 
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.
 
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).
 
Westside guy said:
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).

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.
 
mattroberts said:
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
Look into Darwin ports project. Also, macdevcenter.com
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.