PDA

View Full Version : X11 Path


ospfguru
07-27-2004, 07:45 AM
I am trying to install everything for ethereal to run per the website:

http://jackburton.blogspot.com/2004_06_20_jackburton_archive.html

However when I get to this step in the instructions:

"Here we go, I carefully check my path (cat $PATH), yup, /opt/local/bin is there. Now type 'ethereal' (without the quotes, of course) and Woo-Hoo! Ethereal is running."

I do not see the "/opt/local/bin" when running the command "cat $PATH", I see the following in the X11 terminal window:

Comfort Suites:~ TopKick$ cat $PATH
cat: /usr/bin:/bin:/usr/sbin:/sbin:/Users/TopKick:/usr/X11R6/bin: No such file or directory
Comfort Suites:~ TopKick$

Yet however I see it in my path when running $PATH from a terminal window, in doing a google search and researching what is going on I have tried several things to resolve this but I cannot identify the file that controls the path for the terminal app nor do I seem to be having any effect on the path for X11.

Thus when in an X11 term window and I type "sudo ethereal":

Comfort Suites:~ TopKick$ sudo ethereal
Password:
sudo: ethereal: command not found
Comfort Suites:~ TopKick$

I am fairly sure the reason its not working is do to path statements, some help would be appreciated.

yellow
07-27-2004, 08:14 AM
If you create a .login in your home directory and declare your path there, when you start X11, it should be honored.

I also Customized my xterms to make sure they source my ~/.login to inherit my path in new xterm windows.

ospfguru
07-27-2004, 08:52 AM
Yellow, thanks for the quick reply. I created a .login file in my home directory as advised and added this statement:

PATH=$PATH:/opt/local/bin

Then I started X11 and ran the cat $PATH command, I still do not see the right path which I believe is still stopping ethereal from starting properly:

AppleKick:~ TopKick$ cat $PATH
cat: /usr/bin:/bin:/usr/sbin:/sbin:/Users/TopKick:/usr/X11R6/bin: No such file or directory
AppleKick:~ TopKick

I am thinking that your last statement regarding customizing xterms to inherit .login is the right way to go, how is that accomplished.

sao
07-27-2004, 09:35 AM
ospfguru,

Maybe it will help to write in your ~/.bash_profile:


# Set up DarwinPorts if it is available.
if [ -d "/opt/local" ]; then
export CFLAGS="${CFLAGS} -I/opt/local/include"
export INFOPATH=/usr/share/info:/opt/local/share/info
export LDLAGS="${LDLAGS} -L/opt/local/lib"
export MANPATH=/usr/share/man:/usr/local/man:/opt/local/man
export PATH="/opt/local/bin:$PATH"
fi

ospfguru
07-27-2004, 09:50 AM
Sao,

I entered the following in .bash_profile which I created in my home directory as follows;

AppleKick:/Users/TopKick root# cat .bash_profile
# Set up DarwinPorts if it is available.
if [ -d "/opt/local" ]; then
export CFLAGS="${CFLAGS} -I/opt/local/include"
export INFOPATH=/usr/share/info:/opt/local/share/info
export LDLAGS="${LDLAGS} -L/opt/local/lib"
export MANPATH=/usr/share/man:/usr/local/man:/opt/local/man
export PATH="/opt/local/bin:$PATH"
fi

AppleKick:/Users/TopKick root#

Then I started X11 and ran the path command, there have been no changes. So I tried to place the above commands into the .login file as a hunch and restarted X11, still no luck. Grrrr.

yellow
07-27-2004, 09:58 AM
I see what I've done..

In the Customize section of the X11.app (Applications->Customize), I've changed the string that opens new xterms and login windows thusly to make sure that the path and aliases are read (I still use tcsh):


xterm -sb -sl 5000 -rightbar;"source /Users/yellow/.login";"source /Users/yellow/.tcshrc"
xterm;"source /Users/yellow/.login"

ospfguru
07-27-2004, 10:19 AM
Yellow,

I followed my interpretations of your instructions to customize, the bad news I did not do it right, the good news if I enter:

source /Users/TopKick/.login


Then ethereal starts so definitely on the right track here. Thus I clearly need to customize. Here is what I did, applications, customize and a new window opens. In this window there are three columns, with three entries:

name command shortcut

I cannot seem to get the command: xterm:"source /Users/TopKick/.login" into a spot that has the desired effect, I created a new entry as follows:

Name = test
Command = xterm;"source /Users/TopKick/.login"
Shortcut = blank

When I select test from the applications menu a new window opens however running cat $PATH does not show the path, I am sure there is some nusiance here that I am missing due to inexperience. Thoughts?

sao
07-27-2004, 10:19 AM
ospfguru,

You can also try writing a ~/.MacOSX/environment.plist file to set your environment variables:

http://developer.apple.com/qa/qa2001/qa1067.html

yellow
07-27-2004, 10:28 AM
You should be able to get all that in the Command field. What I detailed above, was taken directly from the Command field.

ospfguru
07-27-2004, 11:02 AM
I went back and recreated the command field based on what you just wrote, the field now contains:

xterm -sb -sl 5000 -rightbar;"source /Users/TopKick/.login"


But the path is still not showing up, everything looks right to me:


AppleKick:/Users/TopKick root# cat .login
PATH=$PATH:/opt/local/bin:/opt/local/sbin
AppleKick:/Users/TopKick root#

-rw-r--r-- 1 TopKick TopKick 42 27 Jul 11:47 .login

yellow
07-27-2004, 11:05 AM
You're currently logged in as root. All the changes that you're making are to the TopKick user. Log out and log back in as TopKick and see if the changes are functional.

ospfguru
07-27-2004, 11:36 AM
AppleKick:~ TopKick$ cat $PATH
cat: /usr/bin:/bin:/usr/sbin:/sbin:/Users/TopKick:/usr/X11R6/bin: No such file or directory
AppleKick:~ TopKick$

yellow
07-27-2004, 11:39 AM
Can you give us a ls -laF of /opt/local?

It's very strange that Terminal see the /opt directory but X11 doesn't.

ospfguru
07-27-2004, 11:52 AM
In terminal:

AppleKick:/Users/TopKick root# ls -laF /opt/local
total 8
drwxrwxr-x 10 root admin 340 27 Jul 12:31 ./
drwxr-xr-x 3 root admin 102 26 Jul 13:33 ../
drwxrwxr-x 80 root admin 2720 27 Jul 12:31 bin/
drwxrwxr-x 8 root admin 272 27 Jul 11:38 etc/
drwxrwxr-x 34 root admin 1156 27 Jul 11:34 include/
drwxrwxr-x 183 root admin 6222 27 Jul 12:31 lib/
drwxrwxr-x 2 root admin 68 26 Jul 13:33 libexec/
lrwxr-xr-x 1 root admin 9 26 Jul 13:33 man@ -> share/man
drwxrwxr-x 17 root admin 578 26 Jul 15:08 share/
drwxrwxr-x 4 root admin 136 27 Jul 11:38 var/
AppleKick:/Users/TopKick root#

Just to be safe in X11 as well:

AppleKick:~ TopKick$ ls -laF /opt/local
total 8
drwxrwxr-x 10 root admin 340 27 Jul 12:31 ./
drwxr-xr-x 3 root admin 102 26 Jul 13:33 ../
drwxrwxr-x 80 root admin 2720 27 Jul 12:31 bin/
drwxrwxr-x 8 root admin 272 27 Jul 11:38 etc/
drwxrwxr-x 34 root admin 1156 27 Jul 11:34 include/
drwxrwxr-x 183 root admin 6222 27 Jul 12:31 lib/
drwxrwxr-x 2 root admin 68 26 Jul 13:33 libexec/
lrwxr-xr-x 1 root admin 9 26 Jul 13:33 man@ -> share/man
drwxrwxr-x 17 root admin 578 26 Jul 15:08 share/
drwxrwxr-x 4 root admin 136 27 Jul 11:38 var/
AppleKick:~ TopKick$

yellow
07-27-2004, 12:07 PM
Verify that the changes you made to X11 when logged in as root also are alive and well when logged in as TopKick. Or are you "su"ing to root in the Terminal while logged in as TopKick?

And what does your .login look like? Like sao's example above for the .bash_profile?

ospfguru
07-27-2004, 12:27 PM
I am su'ing to root when logged in as TopKick in terminal

yellow
07-27-2004, 12:37 PM
And what does your .login look like? Like sao's example above for the .bash_profile?

Sorry, it's tough to get a handle on this kinda stuff via a forum, but we'll figure it out! :)

ospfguru
07-28-2004, 07:24 AM
Last login: Wed Jul 28 08:08:06 on ttyp4
Welcome to Darwin!
AppleKick:~ TopKick$ cat .login
PATH=$PATH:/opt/local/bin:/opt/local/sbin
AppleKick:~ TopKick$

No worries yellow, if there was a speed this up I would jump on it but the benefit of the forums is that people can potentially learn and figure out what we find.

yellow
07-28-2004, 07:38 AM
PATH=$PATH:/opt/local/bin:/opt/local/sbin

Can we throw some double quotes around this? Call it superstition.. :)

PATH="$PATH:/opt/local/bin:/opt/local/sbin"

Then source it in your X11 xterm, and see what happens.

ospfguru
07-28-2004, 08:34 AM
Yellow, I added what you requested and it did not seem to work as we would of hoped, the quotes also did not seem to have any negative effect. I added the quotes, did the cat $PATH, with no change in x11 (Started x after i made changes as well) I manually sourced the .login file and we saw yesterday the path now had the right statements in it as expected. This is the darndest thing.

yellow
07-28-2004, 08:55 AM
Sorry, I'm misunderstanding here.. when you manually sourced it within the X11.app, it worked and the path was what it should be, or you got the "No such file or directory"?

ospfguru
07-28-2004, 09:01 AM
I made the change in terminal, opened X11, opened a term window in X11 that has the source command as part of its startup. I checked the path and it was still missing, then I manually sourced the .login and rechecked the path - it was there as expected. Here is the output:

AppleKick:~ TopKick$ cat $PATH
cat: /usr/bin:/bin:/usr/sbin:/sbin:/Users/TopKick:/usr/X11R6/bin: No such file or directory
AppleKick:~ TopKick$ source /Users/TopKick/.login
AppleKick:~ TopKick$ cat $PATH
cat: /usr/bin:/bin:/usr/sbin:/sbin:/Users/TopKick:/usr/X11R6/bin:/opt/local/bin:/opt/local/sbin: No such file or directory
AppleKick:~ TopKick$

yellow
07-28-2004, 09:28 AM
Ah-ha. Don't use cat. Use echo. Cat is the source of the "not found".

echo $PATH

Make sure the source line in the X11.app customization if correct, all the proper semi-colons and double-quotes, and it's pointing at the right .login file.

ospfguru
07-28-2004, 09:37 AM
Used echo, no change in X11:

AppleKick:~ TopKick$ echo $PATH
/usr/bin:/bin:/usr/sbin:/sbin:/Users/TopKick:/usr/X11R6/bin
AppleKick:~ TopKick$

yellow
07-28-2004, 09:45 AM
And did you make sure:

Make sure the source line in the X11.app customization if correct, all the proper semi-colons and double-quotes, and it's pointing at the right .login file.

ospfguru
07-28-2004, 11:16 AM
I believe so yes, here is the line exactlyit appears in the command column for xterm that I created to test:

xterm -sb -sl 5000 -rightbar;"source /Users/TopKick/.login"

yellow
07-28-2004, 11:28 AM
Hmm.. what about the permissions on ~/.login. It's owned by you, right? Readable and writable by you, right? Yes.. I'm stretching here.. :)

ospfguru
07-28-2004, 11:33 AM
paths and permissions are a real pain for me but I do believe they are set correctly:

-rw-r--r-- 1 TopKick TopKick 44 28 Jul 09:29 .login

yellow
07-28-2004, 11:39 AM
Yep, that's right as well.

Well, I'm officially stumped. Maybe there's some bash/tcsh voodoo that I'm missing.

I suggest trying sao's suggestion about the .bash_profile and changing your customization in X11.app to point at rehashing/sourcing the .bash_profile.

Jack Burton
08-05-2004, 10:18 PM
ospfguru,

Make sure when you first start X11 and are in xterm, DO NOT su to root. If you su to root before you create your .profile, only the root account will have permissions to the bash .profile. If you have a .profile file, delete it, or

chmod 777 .profile

Again, when you are not su'd to root, and making sure you are in your /Users/Topkick directory, type the following command:

vi .profile

This will open the VI text editor and allow you to edit your BASH profile. Hopefully yours is empty.

Press "I" to enter insert mode and type the following on the first line (with the EXACT case here):

export PATH=$PATH:/opt/local/bin

Then press the following keys:

[esc-key]:wq

This writes the file (changes) and quits vi.

Now you're back at your non-su'd xterm prompt. Type:

export PATH=$PATH:/opt/local/bin

and now try echo $PATH (Yes, you should use echo instead of cat, either will work, but echo is more correct) and see if /opt/local/bin is in your path.

If it is, try sudo ethereal and see what happens.

You can only launch ethereal from xterm in X11, you can't launch it from the OS X terminal, you will get a GTK error.

Remember, if you 'su' to root, you should retain your current $PATH, if you 'su -', you take on the root user's profile $PATH.

Hope this helps.

cleanzero
08-27-2004, 08:54 AM
Not sure i'm talking about the same problem, sorry...
I installed some apps under /usr/local/bin and there was no way to see this path under xterm even if it was rightly set in ~/.profile, so i added xterm;source /Users/alf/.login in the application window of X11 and it was still not working. Then i changed in source /Users/alf/.login; xterm and it just works fine! Every time i open a new xterm the path is there!