Opening Xterm From Unix Shell

Discussion in 'Mac Programming' started by ScKaSx, Jun 6, 2006.

  1. ScKaSx macrumors regular

    Feb 27, 2006
    Hi All,

    This problem is linked to several problems I've had graphing in unix. I'm not sure what to set my DISPLAY variable to in the Unix 'env' file. Currently I am using, DISPLAY=:0.0. However, this isn't working, seeing as I can't open X11 from the unix shell and I can't plot using gnuplot. Any help with this would be appreciated.

    The application I'm using this for is dynamic plotting from my C program. Please help.

  2. crackpip macrumors regular

    Jul 23, 2002
    You do have up and running, right? I have my display set at :0.0 and it works fine. You might try a couple of different X11 apps in /usr/X11R6/bin. I have had issues where certain apps would pop-up just fine, while others failed.

  3. ScKaSx thread starter macrumors regular

    Feb 27, 2006
    Yeah, I can load display graphics fine from X11. Although (and I know this is nit picky) I wanted to load xterm from the terminal window. I also want to plot mulitple graphics windows from the terminal, which it doesn't seem capable to do through gnuplot. Let me know if you have any ideas. Thanks.

  4. plinden macrumors 68040


    Apr 8, 2004
    Typing this in Terminal works for me:
    open /Applications/Utilities/
    This opens an xterm without scroll bars, which I don't like, and I usually do the above followed by:
    xterm -sb -sl 1000 &
    I'm not sure if this is also a problem with you, but if you're having problems displaying in X11, you could also try typing:
    xhost +
  5. AlmostThere macrumors 6502a

    You can avoid X11 altogether if you download and install AquaTerm.

    In your .gnuplot file add "set term aqua" (assuming gnuplot 4.x)
  6. emotion macrumors 68040


    Mar 29, 2004
    Manchester, UK
    Be very careful with that one (xhost +). It's possible to remotely log your keystrokes when your display is open like that.
  7. GeeYouEye macrumors 68000


    Dec 9, 2001
    State of Denial
    /bin/bash -c "export DISPLAY=:0.0; /usr/X11R6/bin/xterm -e /path/to/gnuplot"

    That should work.
  8. mrichmon macrumors 6502a

    Jun 17, 2003
    If you don't want X11 to automatically open the default xterm window then you can comment out the xterm command from the X11 startup script. The commands started when you launch X11 are defined in the file /etc/X11/xinit/xinitrc.

    If you don't want to start an xterm when X11 starts then you should scroll to the bottom of that file to find the line "xterm &" in the section labeled "start some nice programs" comment out the xterm line using a "#" character at the start of the line to stop xterm from loading when X11 starts.

    If you do want xterm to start, but you want it to start with particular command line options then you can add those options to the "xterm" line in the xinitrc file. Make sure that the xterm command ends with a "&" character to run xterm in the background.

    Note: xinitrc is read only and owned by root so it needs to be edited by a superuser.

    Warning: Be very careful editing xinitrc since a bad command in this file will prevent X11 from starting correctly.

Share This Page