PATH, was: Re: [OS X TeX] OT: Autotrace

Roussanka Loukanova rloukano at stp.lingfil.uu.se
Sun Mar 18 14:53:44 EDT 2007


Hi,

I have a marginally related question about setting up the PATH variable 
for accessing scripts defined by the user. Which is the good way to add 
the user's ~/bin directory to the search path: at its beginning or end, 
e.g. by adding a resepctive line in .bashrc

(1) export PATH=$HOME/bin:$PATH

(2) export PATH=$PATH:$HOME/bin

(3) or something else?

I used to have (1) on my Linux machine, then someone said (2) was the 
good way, and then the other way around...

Roussanka

On Wed, 14 Mar 2007, Bruno Voisin wrote:

> Le 14 mars 07 à 03:16, Enrico Franconi a écrit :
>
>> In don't know when what you claim was the case, but for sure this is 
>> definitely *not* the case now. Have a look at:
>> <http://darwinports.opendarwin.org/docs/ch01s03.html#configure_dports>
>> where it is clearly stated that the macports path is placed *after* your 
>> standard path. If what you said were true, then I would agree with you (and 
>> this is the case for fink, for example, which, as you said, created several 
>> problems to me as well for this reason); but this is not the case of 
>> MacPorts. Sorry - MacPorts is not imperialistic, it lives smoothly with 
>> your mac without changing its standard habits.
>
> I've never seen the change (i.e. moving /opt/local/bin and /opt/local/sbin 
> before the standard path) documented, even in the DarwinPorts and MacPorts 
> mailing list archives, but it's indeed there.
>
> The doc you're referring to is the former doc of DarwinPorts, dating back to 
> 2004. For MacPorts, the doc seems to be the Wiki 
> <http://trac.macosforge.org/projects/macports/wiki> and at the corresponding 
> installation page you'll see:
>
>> The MacPorts binary installer places a .profile file in your home directory 
>> (view files preceded by a dot with 'ls -a'). The contents of this 
>> ~/.profile file adds the MacPorts paths in front of the standard Unix paths 
>> for the default BASH shell. This is done so that if you have utilities or 
>> libraries from both MacPorts and OS X's standard install, the MacPorts 
>> libraries will be run instead of the ones provided by Apple.
>> 
>> export PATH=/opt/local/bin:/opt/local/sbin:$PATH
>
> There is also a discussion of this choice at the FAQ 
> <http://trac.macosforge.org/projects/macports/wiki/FAQ>:
>
>> Will MacPorts link to system libraries rather than its own?
>> 
>> No, MacPorts maintains its own libraries.
>> 
>> Why is MacPorts using its own libraries?
>> 
>> There are several reasons to do so. First, it makes ports more compatible 
>> across different versions of Darwin/OS X. If we can rely on e. g. openssl 
>> 0.9.8 from MacPorts, we don't have to test every port that needs ssl for 
>> every available openssl installation. Apple's software tends to break from 
>> time to time (e. g. openssl refuses to build with an old zlib, but Apple 
>> shipped the old headers of the vulnerable zlib version). Third reason is 
>> up-to-dateness: Apple only features e. g. Python 2.3, not 2.4, with which 
>> some software does not work. The drawbacks on this behaviour also are 
>> minimal: Wasting 10MB for a Python installation is next to nothing if you 
>> have a GB-harddisk and gain consistency all the way in return.
>
> Needless to say, I don't agree with it. It's probably a fine choice if you 
> want MacPorts to take over your system, but not if you want it to co-exist 
> peacefully with OS X.
>
> You can verify that the binary installer, available at either of:
>
> <http://darwinports.opendarwin.org/downloads/DarwinPorts-1.3.1-10.4.dmg>
> <http://svn.macports.org/repository/macports/downloads/DarwinPorts-1.3.1/DarwinPorts-1.3.1-10.4.dmg>
>
> does precisely that: if you look inside the postflight script of the .pkg 
> package on the disk image, you'll find:
>
>> echo ""
>> echo "Checking the PATH variable for $USER..."
>> echo ""
>> 
>> BINPATH=/opt/local/bin
>> SBINPATH=/opt/local/sbin
>> TMP=`/usr/bin/mktemp /tmp/dp.$$`
>> $SHELL -l <<EOF > $TMP
>>    /usr/bin/printenv PATH
>>    exit
>> EOF
>> 
>> if grep $BINPATH $TMP >/dev/null 2>&1; then
>> 	echo "You already have the right PATH - l337!"
>> else
>>    USHELL=`basename $SHELL`
>>   echo "Setting the PATH of $USHELL for $USER in ${HOME:=/Users/$USER}..."
>>    case $USHELL in
>>      *csh)
>>        /bin/cp -fp $HOME/.cshrc $HOME/.cshrc.dpsaved	# we backup the 
>> original
>>        echo "#" >> $HOME/.cshrc
>>        echo "# Your previous .cshrc (if any) is saved as .cshrc.dpsaved" >> 
>> $HOME/.cshrc
>>        echo "# Setting the path for DarwinPorts." >> $HOME/.cshrc
>>        echo "set path=($BINPATH $SBINPATH" '$path'")" >> $HOME/.cshrc
>>        chown $USER $HOME/.cshrc
>>        echo "Finished modifying $HOME/.cshrc"
>>       ;;
>>      *sh)
>>        /bin/cp -fp $HOME/.profile $HOME/.profile.dpsaved # we backup the 
>> original
>>        echo "#" >> $HOME/.profile
>>        echo "# Your previous .profile  (if any) is saved as 
>> .profile.dpsaved" >> $HOME/.profile
>>        echo "# Setting the path for DarwinPorts." >> $HOME/.profile
>>        echo "export PATH=$BINPATH:$SBINPATH:\$PATH" >> $HOME/.profile
>>        chown $USER $HOME/.profile
>>        echo "Finished modifying $HOME/.profile"
>>        ;;
>>      *)
>>        echo "Unknown shell! Please set your own PATH manually."
>>        ;;
>>    esac
>> fi
>> 
>> export PATH=$BINPATH:$PATH
>
> Bruno Voisin

------------------------- Helpful Info -------------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
TeX FAQ: http://www.tex.ac.uk/faq
List Archive: http://tug.org/pipermail/macostex-archives/
List Reminders & Etiquette: http://www.esm.psu.edu/mac-tex/list/





More information about the MacOSX-TeX mailing list