image
image
Ticket Options
Question Details
TICKET ARCHIVE -> Nedit
joe_burban - Sep 30, 2005 - 3:28 pm
image
image
Dear Support,

I have downloaded and installed nedit-5.5-MacOSX. I would like to set-up so that it's easier to run.

Presently, I can run nedit by clicking on its icon in Applications folder *after* X11 is running. I would like to do two things:

1. I would like to modify my path so that in X11 I can simply enter "nedit" to run the program.

2. I would like to be able to double click the nedit program icon at any time & have X11, then nedit run automatically.

{I am familiar with cshell and the .cshrc file -- I haven't figured out about Mac's nix workings. It seems similar to bash (with which I have little experience}

thx for your help.

Christopher

macbri - Oct 1, 2005 - 1:00 am
image
image
Hi Christopher -

My name is Brian and I'll be happy to help you with this issue. First off, can you tell me what version of Mac OS X you're running? I downloaded Nedit 5.5 and when I click on the 'nedit' icon X11 automatically launches for me. I'm using "Tiger" Mac OS X 10.4.2. However, we can write a script to perform the same task for you if necessary.

As for adding nedit to your path, this we can do but again it requires that either X11 is running, or else a script to run it for you.

So, if you agree with me, let's get the "automatic X11 launch" working first and then set up your path once that's resolved. So for now, again what version of Mac OS X do you have, and second, if you double-click the 'nedit' icon WITHOUT running X11 first, what exactly happens?

- Brian
--------
Brian S.
MacOSX.com Technical Support
brian@macosx.com
joe_burban - Oct 1, 2005 - 8:53 am
image
image

Hi Brian,

I'm using OSX 10.3.9.

*Normally,* whenever I double click the nedit icon, a window pops up & asks which application to use. However, just today as I tried double clicking-nedit, it all started properly (X11 launched, then nedit). [It has been quite busy for me lately; it is possible that I have forgotten that I solved this problem]

In any case,

nedit is not yet in my path (I just checked that one). I hope that you'll still agree to helping me to set it up. It will always be started from X11 (as I often run other X11 apps too) -- if we can get it to run in X11 from any directory, that would be great!

Thanx for your help.

Christopher


macbri - Oct 2, 2005 - 5:48 pm
image
image
Hi Christopher -

Well, simplest case, assuming X11 is already running, you can just add the path to your ~/.profile file (create the file if it doesn't already exist). Let's say you installed nedit in the following folder: /Applications/nedit-5.5-MacOSX/. Your .profile should then contain the line:

export PATH=$PATH:/Applications/nedit-5.5-MacOSX

Save your .profile, open a new terminal window, and voila!

Now, if you instead wish you can write a shell script to check if X11 is running, and launch it if it's not running. A simple way to check this is to search for /tmp/.X0-lock (note that's a zero not the letter 'o'):


#!/bin/bash
#
# Script to launch nedit after checking for /tmp/.X0-lock
# to ensure we launch X11 first if it's not already running.

export X11PATH=/Applications/Utilities
export NEDITPATH=/Applications/nedit-5.5-MacOSX

if [ ! -f /tmp/.X0-lock ]; then
open $X11PATH/X11.app
export DISPLAY=:0.0
fi
$NEDITPATH/nedit $*
#--------------------------END---------------

Note the use of the '$*' argument to nedit, this will pass any command-line arguments, such as a filename, if you supply one.

This file would be saved as 'nedit' in say ~/bin. Then make sure it's executable:

cd ~/bin
chmod +x nedit

Finally, add ~/bin to your path INSTEAD of /Applications/nedit-5.5-MacOSX (again this is done in your profile):

export PATH=$PATH:~/bin


Hope this helps! If you have any questions don't hesitate to let me know.

--------
Brian S.
MacOSX.com Technical Support
brian@macosx.com
joe_burban - Oct 2, 2005 - 10:46 pm
image
image

Great!

Brian, Thank you.

As you suggested, I modified the .profile. It all works as I need now.

Take care,

Christopher

joe_burban - Oct 2, 2005 - 11:16 pm
image
image

Brian,

hmm.. it sort of works -- I must first execute the command "source .profile" in X11 in order for this to work. I have restarted the computer -- but still must enter that command.

Are there several .profile files? or perhaps X11 isn't reading this whenever it runs.

These, I'm sure, are simple problems -- however, I'm still fairly new to Macs, and my scripting experience in Unix is limited to modifying already-written scripts (for cshell).

Regards,

Christopher
macbri - Oct 2, 2005 - 11:50 pm
image
image
Hi there -

Well, that shouldn't be the case, as you expected. If you start X11 I assume an xterm starts up also? What happens if you type:

echo $SHELL

in that window? Also, what permissions do you have on your ~/.profile? You'll get that with:

ls -l ~/.profile

We'll get this working!

- Brian

--------
Brian S.
MacOSX.com Technical Support
brian@macosx.com
joe_burban - Oct 3, 2005 - 11:10 pm
image
image
Hi Brian,

When I enter "echo $SHELL", the output is:

/bin/bash

The permissions on .profile are -rw-r--r--

I ran pico as sudo in order to add the path to .profile. The command "more .profile" shows the path that you recommended I add.

In X11, if I enter the command "source .profile" nedit will launch from command line. Computer restart doesn't seem to alter the manner in which .profile is read at launch of X11.

Pls let me know if there's any more diagnosis that I can do.

Christopher
macbri - Oct 3, 2005 - 11:32 pm
image
image
Christopher -

Thanks for the detailed info. in fact you may have hit on something - running "sudo pico" would cause .profile to be owned by root and not your account. You should see this with the "ls -l" command. If this is the case, a quick way to fix it is to do:

sudo chown `whoami` ~/.profile

Open a new terminal and see if the path has been set properly with:

echo $PATH

Let me know if that helps!

--------
Brian S.
MacOSX.com Technical Support
brian@macosx.com
joe_burban - Oct 4, 2005 - 12:29 am
image
image

Brian,

This isn't the solution yet, but I think we're making headway.

The .profile was originally owned by root. Changing owner ship to me `whoami` didn't fix the problem.

So, I checked ownership and PATH in both a terminal window and in an xterm. Ownership is, as expected, the same. However, xterm path is different from terminal path.

xterm path:
/usr/bin:/bin:/usr/sbin:/sbin:/Users/Toper:/usr/X11R6/bin

terminal path:
/sw/bin:/sw/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/teTeX/bin/powerpc-apple-darwin-current:/Applications/nedit-5.5-MacOSX:/usr/X11R6/bin

I am somehow not surprised that these paths are different. By editing .profile, were we simply adjusting path used by terminal and mac os stuff? Having no effect on X11 stuff?

Christopher

macbri - Oct 4, 2005 - 1:14 am
image
image
Hey Christopher!

Wow, seems like we've stumbled on a quirk! So I use /bin/tcsh as my shell, and modified my account settings to have that be my default. So I use ~/.cshrc and any modifications to the path in that file show up in Terminal.app as well as the xterm in X11.app. BUT, I made a test account using /bin/bash as the shell, and you're absolutely right - changes to .profile are not propagated to the xterm. If you rename your setup file as ~/.bashrc then it works for Xterm but not in Terminal.app.

Here's the solution - make a soft link to your .profile and call it .bashrc, and this will then support both Terminal and xterm without having to have 2 seperate files:

cd ~/
ln -s .profile .bashrc

Give that a go and see what happens.
--------
Brian S.
MacOSX.com Technical Support
brian@macosx.com
joe_burban - Oct 5, 2005 - 12:36 pm
image
image
Brian,

aha! The link works. Thank you for all your help. This has been *by far* the most useful guidance I have received from either macosx or from the apple support/discussion site.

Christopher

macbri - Oct 5, 2005 - 5:05 pm
image
image
Hi Christopher -

Thanks for your very kind words, and I'm glad to hear it's all working at last! It was a pleasure to help you, and if you ever need help again be sure to come back to us here at macosx.com!

- Brian
--------
Brian S.
MacOSX.com Technical Support
brian@macosx.com

IF THIS IS YOUR QUESTION AND YOU WISH TO RESPOND, LOGIN HERE FIRST.


Search Engine Friendly URLs by vBSEO 3.1.0