[OS X TeX] A recipe for installing TeXLive (TUG)

Claus Gerhardt gerhardt at math.uni-heidelberg.de
Sun Nov 19 02:47:10 CET 2006


Let me give a detailed  recipe for installing TeXLive 2005 using its  
default installation. This second version corrects some mistakes that  
I made in the first the corrections of which I have already posted.  
There won't be any new corrections, it is only a complete, corrected  
recipe.

The most *important* correction is, that on an intelMac the term  
"powerpc" has to be replaced by "i386" *everywhere*!

This applies especially to the Applescript for the symlink. In order  
to keep this recipe readable, I shall refer to this change only once  
again in that particular Applescript and nowhere else. But those with  
an intelMac should be aware of it.

(I) Prerequisites:

(1) Create this Applescript application for switching the display of  
hidden files on and off, that I offered in a previous mail and switch  
the display of hidden files on. I copy it again below.

I am not the author, but I forgot where I downloaded it from and who  
wrote it, I only added a small detail.

Save this Applescript as an application and store its icon in the Dock.

--Applescript

tell application "Finder" to quit
display dialog "Show Hidden Files..." buttons {"ON", "OFF", "Cancel"} ¬
	default button 3
copy the result as list to {buttonpressed}

try
	if the buttonpressed is "OFF" then do shell script ¬
		"defaults write com.apple.finder AppleShowAllFiles OFF"
	if the buttonpressed is "ON" then do shell script ¬
		"defaults write com.apple.finder AppleShowAllFiles ON"
end try

tell application "Finder" to launch

-- End of script


(2) Create the Applescript (not application) that will create a  
symlink, I shall provide a copy below with the full details so that  
you will have nothing to change. The path will be slightly different  
from what I copied previously, but then I used my own path, which is  
different, since I didn't follow the default.

(3) Make sure that you have a copy of BBEdit or maybe Textwrangler  
for editing two files. Textwrangler can be downloaded for free, but I  
don't know if it will also allow editing with administrative  
permissions. You should test first that you can do that by opening  
(for the rest of the recipe I shall always assume to work in BBEdit)
/private/etc/profile

You can find this file by double clicking on the alias "etc" that you  
will see when double clicking on your hard disk icon:

drag the file "profile" to BBEdit's icon so that it will be opened.  
At the end of the file you will see something like

## TeX modifications start at Fri Nov  3 17:39:47 CET 2006
## Do not remove the previous line
if [ `whoami` != "root" ]
then
   PATH="$PATH:/usr/local/texprograms"
   export PATH
fi
## Do not remove the next line
## TeX modifications end at Fri Nov  3 17:39:47 CET 2006

probably with different dates and certainly with a different path,  
since this is already the correct path that should be implemented  
after the installation of TeXLive.

Delete any letter and retype it so that the file has been changed.  
When doing so you will first be asked, if the status of the file  
should be changed, click "yes", and later when you will save it, you  
will be asked for your password,  save the file after you retyped the  
letter.

This will be proof that you can edit the relevant files, only two.

If you cannot edit this file then forget the whole thing.

This profile file contains the system wide path for the bash shell.  
The corresponding file for the C-shell (csh) is called csh.login and  
is in the same directory. It contains the similar lines at its end.

Later you should edit both files by changing the path, I am copying  
my old path for the C-shell, which still contains Gerben's entry,

/usr/local/TeXLive/bin/powerpc-apple-darwin-current

to
/usr/local/texprograms

Explicitly, the file "profile" should look like above at the end, and  
the end of the file csh.login should look like

## Do not remove the next line
## setloginpath added /usr/local/bin end at Mon May  9 01:55:00 CEST  
2005
## TeX modifications start at Fri Nov  3 17:39:47 CET 2006
## Do not remove the previous line
if ("${uid}" != "0") then
   set path = ( ${path} "/usr/local/texprograms" )
endif
## Do not remove the next line
## TeX modifications end at Fri Nov  3 17:39:47 CET 2006

The exact dates are completely irrelevant.

(4) If you have already Gerben's TeXLive installed then you should  
change the name of his TeXLive folder to something else like  
gwTeXLive, it is in

/usr/local/


(5) Download the compressed TeXLive dmg (~683MB) from CTAN, google  
for texlive2005-inst-20051102.iso

Here is also a full download address

http://tug.ctan.org/cgi-bin/getFile.py?fn=/systems/texlive/Images/ 
texlive2005-inst-20051102.iso.zip


Unzip the download and mount it.

(6) Open the Terminal. The windows of the terminal are called shells,  
if your window shows the name bash at the top, then your in business,  
otherwise you have to switch to a bash shell, by opening the terminal  
preferences and enter the command
/bin/bash

in the line below the second button and enable that button. Quit the  
terminal and restart it. Now you should have a bash shell, i.e., your  
prompt should be a $ sign. If don't have a $ sign, retry or forget  
the whole thing.

(II) Installation of TeXLive:

(1) In the terminal window, after the prompt type

cd /Volumes/TeXLive-2005

This new directory should now be shown before the prompt. We are now  
installing TeXLive in the default location
/usr/local/texlive/2005

After the installation nothing will have changed in your tex  
environment, you will only have an additional 1GB of files on your  
hard disk. Especially, you can always safely delete the folder
/usr/local/texlive/2005

and use your old tex installation without any worries.

Changes will only occur after we have set the symlink, changed the  
system wide path, and run the configuration script.

Now let us start the installation, by entering the command

sudo sh install-tl.sh

You will be asked for your password. Then the script will work for a  
few moments until you are asked to enter a command by choosing from a  
list of options. We are choosing the default options, i.e., we give  
the command start installation by entering

i

and hitting return. TeXLive will now be installed, lasting about 10  
min, depending on your machine.

(2) Now set the symlink, by using the Applescript, which you should  
create, if you haven't already done so. The   entries should be  
exactly as shown below

-- Applescript
-- symlink

-- Nov. 2006
-- Claus Gerhardt

(* It is necessary to use the full path for source file and target  
file, if the files or directories are not in the same directory.

Notice that the administrator privileges will be valid for a few  
seconds after you entered your password, so don't play around with  
the script, it won't ask for your password again in those circumstances.

Notice that on an intelMac the term "powerpc" has to be replaced by  
"i386"*)


set sourceName to "/usr/local/texlive/2005/bin/powerpc-darwin" --or  
i386-darwin

set symlinkName to "/usr/local/" & "texprograms"

set scriptPath1 to "/usr/local/"

set shellScript to "cd " & scriptPath1 & ";"
set shellScript to shellScript & "rm -fR " & symlinkName & ";"
set shellScript to "ln -s  -f " & sourceName & " " & symlinkName

do shell script shellScript with administrator privileges


-- End of script

Run the script in Script editor, you will be asked for your password.

Check, if everything is correct, by typing in a *new* the terminal  
window (notice to open a new window, so that the terminal is aware of  
the new symlink)

readlink /usr/local/texprograms

and hitting return, notice that there is a free space after readlink.  
The answer should be

/usr/local/texlive/2005/bin/powerpc-darwin

If this is not the case, check, if you made a mistake in the script,  
and try again. If the error persists, stop and write to the list (you  
must have made a mistake, very unlikely).

(3) Setting the system wide path:

Change the system wide path as described in (I), (3).

(III) The configuration phase.

Quit the terminal and reopen it.

First we check, if the path is correct. Enter

echo $PATH

The answer should be something like

/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/texprograms

/usr/local/texprograms should be present.

Then, enter (I am using a4 as paper size, letter is the alternative)

sudo texconfig-sys paper a4

after entering your password tex will be configured.

Richard Koch says that during this phase the format files have also  
been created. This didn't happened in my case.

Thus, it doesn't hurt to create the formats explicitly

sudo fmtutil-sys --all

Your are now almost set. You made a full installation of TeXLive,  
installing all packages, all hyphenations, formats, etc.

To run tex, you must now enter the new path

/usr/local/texprograms

in the appropriate place in TeXShop's preferences and, if you use  
shell scripts, e.g., indirectly by using some of my Applescripts,  
their paths have to changed too to

set path= ($path  /usr/local/bin  /usr/local/texprograms)

Happy texing.

Below I copy an Applescript that will reveal the original location of  
the currently active tex, save it as macro in TeXShop.

Claus

-- Applescript
-- reveal-tex
-- Claus Gerhardt

(*This script reveals the location of the currently active tex  
program.*)


set dirName to do shell script "readlink /usr/local/texprograms"

set revealTex to "This is the directory of the currently active tex:  
" & dirName

display dialog revealTex buttons {"OK"} default button "OK"




------------------------- Info --------------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
          & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Archive: http://tug.org/pipermail/macostex-archives/




More information about the macostex-archives mailing list