View Full Version : Launching X11, xterm with command

Mar 21, 2005, 10:36 PM
Does anyone know a way to launch Apple's X11, and then tell the xterm that shows up to run a command? I have the equivalent working for Terminal.app (via NSTask), but I really need to be able to do the same thing for X11. I'm not opposed to kludgy solutions, but so far I've come up with nothing.

Mar 22, 2005, 12:29 AM
No need for a kludge. Launch a terminal and run these commands:

$ cp /etc/X11/xinit/xinitrc .xinitrc
$ chmod +x .xinitrc

Now edit .xinitrc, and find this section:

# start some nice programs

xterm &

You can add another 'xterm' command, suppose you want to run "top":

xterm &

xterm -e top &


Mar 23, 2005, 02:55 PM
Thanks, but I guess I wasn't being clear. I meant how to programmaticly do that in Cocoa, but no worries, I've got it working now. :)