Title: Re: [Fink-beginners] X11, Terminal confusion

There were various solutions to my posted question (which is copied below).  Sebastien Maret and Martin Costabel provided solutions (thanks!)--I've included their solutions at the bottom of this email as well.

I finally ended up inserting this code into my .profile file (from Sao at forums.macosxhints.com):

if [ ${#DISPLAY} -eq 0 ]; then
   export DISPLAY=':0.0'
 fi

which allows one to start X11 applications from a Terminal.app.

Another potential solution that seems to work is to create an alias in your .profile file:
alias xem='/usr/bin/open-x11 xemacs'
which has the limitation mentioned by Martin (see his email below).  Typing xem at a command prompt then opens xemacs in a new X11 window.


This question led me to a variety of websites and other resources including the book, Learning unix for Mac OS X Tiger (Dave Taylor, O'Reilly).  Some helpful links include:

http://developer.apple.com/darwin/runningx11.html
http://homepage.mac.com/sao1/fink/index.html
http://developer.apple.com/qa/qa2001/qa1232.html
http://forums.macosxhints.com/showthread.php?s=&threadid=8704
http://fink.sourceforge.net/doc/x11/tips.php?phpLang=en#terminal-app

I hope this helps others with similar questions.

Brian


Original question:

At 10:17 PM -0400 9/26/05, Brian Beckage wrote:
Hello,

I just installed Mac OS 10.4.2 over the weekend and deliberately erased my old HD.  While installing 10.4.2, I also installed Xcode 2 tools (including the Apple X11).  I downloaded the Fink 0.8.0 Binary Installer and all seems to go well.   Note that I did all of the fink installations (sudo apt-get update ; sudo apt-get install fink) from a terminal window (not X11).  Fink seems to be working and so then I install xemacs.

The first 'problem' that I noticed is that when I launch xemacs from the terminal window, a new xemacs window/buffer does not appear with the GUI.  So I guess that perhaps this is related to using a terminal window instead of an X11 window and so I try launching xemacs from an X11 window.  xemacs is not found and NONE of the fink installations are even in the search path:
echo $PATH from the X11 window gives
 (/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11R6/bin)

while echo $PATH from the terminal window gives
(/sw/bin:/sw/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin).

I'm using the bash shell and the .profile file has only the line:

test -r /sw/bin/init.sh && . /sw/bin/init.sh

Why do the X11 and terminal windows have different search paths?

Why does xemacs not launch in a seperate window with a GUI?

Where have I gone wrong?

Thank you for your help.

Brian



Replies:

At 11:00 PM -0400 9/26/05, Sebastien Maret wrote:
Terminal.app starts a login shell while XTerm starts an non login
shell. The .profile file is sourced only by login shells, not by
non login shells (see bash man page). Try to create a .bashrc file
containting the same lines than you .profile shell.

Alternatively, you can put everything in your .bashrc and make a
.profile file containing only "source ~/.bashrc"
Sébastien


At 9:44 AM +0200 9/27/05, Martin Costabel wrote:
Why do the X11 and terminal windows have different search paths?

Short answer: Because your xterm runs bash differently from Terminal.app. Longer answer: There are many different ways to give a decent environment to the shell running in an xterm.
I could describe you at least 7 or 8 from the top of my head;
- some of these are surely described somewhere in the Fink documentation;
- they are all described somewhere in the list archives;
- they involve alternatively the files ~/.xinitrc or ~/.MacOSX/environment.plist or the X11 Applications menu;
- you probably don't want to use any of these but use Terminal.app instead.
Why does xemacs not launch in a seperate window with a GUI?

Short answer: because you don't have DISPLAY set.
Longer answer: Either run xemacs using the /usr/bin/open-x11 script:

  open-x11 xemacs

which has the additional benefit that it starts X11 if it is not yet running, but has the disadvantage that it doesn't take arguments; so you can't say "open-x11 xemacs Abstract.tex",
or set the DISPLAY environment variable globally in your shell:
  export DISPLAY=:0

or set it for xemacs only:

  env DISPLAY=:0 xemacs

You can even use the latter in an alias:

  alias xem='env DISPLAY=:0 xemacs'

and then use xem instead of xemacs in your Terminal.app window.

--
Martin



--
*********************************************************************
Brian Beckage
Department of Botany
University of Vermont
Marsh Life Science Building
Burlington, VT 05405

Phone:  802 656-0197
Fax  :  802 656-0440
email:  [EMAIL PROTECTED]
web  :  www.uvm.edu/~bbeckage
*********************************************************************



Reply via email to