On Oct 1, 2007, at 11:31 PM, Otared Kavian wrote:
Dear Dalyoung,
Like many other ConTeXt users I followed up the many threads about
how to install, successfully, LuaTeX.
In particular I was interested in your experience since I had more or
less the same problems as the ones you described in your latest
messages on the list.
Now my question is: did you succeed to install and use LuaTeX on Mac
OS X?
--- If yes, could you please describe how you did proceed?
--- If no, this means we have to wait more for our salvation...
Thanks for your attention and best regards: OK
OK, I have just summarized my own experience with luatex. Please
comment; if this is helpful at all, we should put it on the wiki.
Thomas
Setting up luatex on OS X
The following remarks are not more than an amplification of what Hans
writes in
magazin #12. However, since some users have had difficulties, here's
a short
summary of the steps that I have followed on my system (OS X 10.4;
system
language set to English; vanilla TeXLive installation) to work with
luatex.
1. Get the latest ConTeXt version.
Download the latest cont-tmf.zip at
www.pragma-ade.com (either stable or beta). Unzip this file in a
texmf-tree. It
is recommended that you do this in a local tree. This way, if you
ever have
problems, you can just delete this local tree and continue working
with the
stable tree that came with your distribution. If you don't know where
your
local texmf tree is located, follow these directions (a line with #
in front
means you should type the line following this # into your Terminal
window;
press "Return" at the end of the line. Comments or explanations which
should
not be retyped are included in <> brackets. Please be careful to retype
exactly, leaving all the quotes etc. in place!).
# kpsewhich --expand-var '$TEXMFLOCAL'
On my system, this expands to
/usr/local/texlive/texmf-local
Now go to this directory
# cd /usr/local/texlive/texmf-local
download the file cont-tmf.zip to this directory and unzip it. On
most systems,
you will need superuser rights to do this; after entering the sudo
command, you
will be asked for your password.
# sudo unzip cont-tmf.zip
Password:
#
Archive: cont-tmf.zip
replace bibtex/bst/context/cont-ab.bst? [y]es, [n]o, [A]ll, [N]one,
[r]ename:
# <type A> <then type RETURN>
After this, a long list of files will scroll by.
2. Regenerate the formats
While we're at it, we might as well regenerate the formats for pdftex-
based
ConTeXT:
# sudo texmfstart texexec --make --all --pdftex
You'll see the output on the Terminal; at the end, texexec should
tell you that
it has regenerated all the formats.
TeXExec |
TeXExec | tex engine path: /usr/local/texlive/2007/texmf-config/web2c/
pdftex
TeXExec | mps engine path: /usr/local/texlive/2007/texmf-config/web2c
TeXExec |
TeXExec | tex: 02/10/2007 17:50:43 > /usr/local/texlive/2007/texmf-
config/web2c/pdftex/cont-en.fmt (7392414)
TeXExec | tex: 02/10/2007 17:50:57 > /usr/local/texlive/2007/texmf-
config/web2c/pdftex/cont-nl.fmt (7473512)
TeXExec | tex: 02/10/2007 17:50:57 > /usr/local/texlive/2007/texmf-
config/web2c/pdftex/mptopdf.fmt (277947)
TeXExec | mps: 02/10/2007 17:50:58 > /usr/local/texlive/2007/texmf-
config/web2c/metafun.mem (482192)
TeXExec |
TeXExec | runtime: 7.575246
3. Set environment variables
In its current beta stadium, luatex needs some environment variables
to be set;
this will probably change soon. In my experiments, on OS X, it needs
these
four variables:
TEXMFCACHE: this decides where the luatex-cache directory will be
created. If
you set this variable to a temporary directory such as /tmp, it will
be deleted
at every reboot. This is a good idea since luatex caches lots of
files and
paths in this directory, so it makes sense to refresh this directory
often.
TEXMFCNF: This should point to the directory where the file texmf.cnf
which
your TeX installation uses is located. In order to find out where
this is, run
this command:
#kpsewhich texmf.cnf
On my system, this points to
/usr/local/texlive/2007/texmf/web2c/texmf.cnf
so we need to set TEXMFCNF to /usr/local/texlive/2007/texmf/web2c.
TEXMF
This should list ALL texmf trees which your TeX installation uses. In
order to
know what these trees are, run this command:
# kpsewhich --expand-var '$TEXMF'
The output of this command on my system is:
{/Users/tas/.texlive2007/texmf-config,/Users/tas/.texlive2007/texmf-
var,/Users/tas/texmf,!!/usr/local/texlive/2007/texmf-config,!!/usr/
local/texlive/2007/texmf-var,!!/usr/local/texlive/2007/texmf,!!/usr/
local/texlive/2007/../texmf-local,!!/usr/local/texlive/2007/texmf-
dist,!!/usr/local/texlive/2007/texmf.gwtex}
In this form, the list contains a few shortcuts and symbols which are
special
to kpsewhich. Remove all the exclamation marks; if there are other
shortcuts in
your output, bring it into a flat list of Unix directories.
LUAINPUTS
These are the directories where the lua scripts are located, they are
on my
system:
{/usr/local/texlive/texmf-local/tex/context/base,/usr/local/texlive/
texmf-local/scripts/context/lua,/Users/tas/texmf/scripts/context/lua}
Since these variables will have to be set every time you run luaTeX,
it makes
sense to automate the process. So we collect all the definitions like
so (these
are the values on my system; adapt to your setup!):
export TEXMFCACHE="/tmp"
export TEXMFCNF="/usr/local/texlive/2007/texmf/web2c"
export TEXMF="{/Users/tas/.texlive2007/texmf-config,/Users/
tas/.texlive2007/texmf-var,/Users/tas/texmf,/usr/local/texlive/2007/
texmf-config,/usr/local/texlive/2007/texmf-var,/usr/local/texlive/
2007/texmf,/usr/local/texlive/texmf-local,/usr/local/texlive/2007/
texmf-dist,/usr/local/texlive/2007/texmf.gwtex}"
export LUAINPUTS="{/usr/local/texlive/texmf-local/tex/context/base,/
usr/local/texlive/texmf-local/scripts/context/lua,/Users/tas/texmf/
scripts/context/lua}"
There are two ways you can set these variables easily:
a. put them in a file; let's call this file .luatex. Every time you
want to run
luatex, just say
# source .luatex
in your terminal.
b. If you want these variables to be set every time you log into your
computer,
put them in a file .bashrc in your home directory (this only works if
your
shell is bash, the default shell in OS X 10.4 and 10.3. If you have
never
tinkered with the shell, it probably is).
Let's test if setting the variables has worked:
# echo $TEXMF
the output on my system is:
{/Users/tas/.texlive2007/texmf-config,/Users/tas/.texlive2007/texmf-
var,/Users/tas/texmf,/usr/local/texlive/2007/texmf-config,/usr/local/
texlive/2007/texmf-var,/usr/local/texlive/2007/texmf,/usr/local/
texlive/texmf-local,/usr/local/texlive/2007/texmf-dist,/usr/local/
texlive/2007/texmf.gwtex}
4. Installing the binaries.
We now have to install and tweak the necessary binaries. First, of
course,
luatex itself. We put it in the same directory with all the other TeX
binaries.
To determine where that is, we issue
# which pdftex
/usr/local/texlive/2007/bin/i386-darwin/pdftex
So we get the latest luatex from www.luatex.org and copy it to this
directory.
We also create two links to luatex:
# cd /usr/local/texlive/2007/bin/i386-darwin/pdftex
# sudo ln -s luatex texlua
# sudo ln -s luatex texluac
There are two more lua scripts which need to be installed.
Unfortunately, Hans
uses a different operating system, so we need to make them executable
first. Go
to the directory where you installed your ConTeXt update, so in my case:
# cd /usr/local/texlive/texmf-local/scripts/context/lua/
# sudo chmod 755 mtxrun.lua
# sudo chmod 755 luatools.lua
After that, we create symbolic links to these programs in the
directory where
we installed luatex:
# cd /usr/local/texlive/2007/bin/i386-darwin/pdftex
# sudo ln -s /usr/local/texlive/texmf-local/scripts/context/lua/
luatools.lua luatools
# sudo ln -s /usr/local/texlive/texmf-local/scripts/context/lua/
mtxrun.lua mtxrun
Again, let's test if this has worked:
# rehash
# which luatools
/usr/local/texlive/2007/bin/i386-darwin/luatools
5. Generating the Database and the formats
You're almost there! Now let luatools generate its internal database:
# luatools --generate
Again, a long list of stuff will scroll by (if luatools gives just a
fewlines
of output, you know that you've made a mistake somewhere along the
way). Here's
the beginning and end on my system:
LuaTools | loading /usr/local/texlive/2007/texmf/web2c/texmf.cnf
LuaTools | preparing configuration in /tmp/luatex-cache/context/
6da32d2ec193ac6d2428d020ce069374/trees/
6da32d2ec193ac6d2428d020ce069374.tma
LuaTools | saving configuration in /tmp/luatex-cache/context/
6da32d2ec193ac6d2428d020ce069374/trees/
6da32d2ec193ac6d2428d020ce069374.tma
[snip]
LuaTools | saving files in /tmp/luatex-cache/context/
6da32d2ec193ac6d2428d020ce069374/trees/
729867c88f88a392262749cb9c3d602b.tma
LuaTools | compiling files to /tmp/luatex-cache/context/
6da32d2ec193ac6d2428d020ce069374/trees/
729867c88f88a392262749cb9c3d602b.tmc
LuaTools |
LuaTools | runtime: 9.74 seconds
We test if luatex is able to find files:
# luatools cont-new.tex
/usr/local/texlive/texmf-local/tex/context/base/cont-new.tex
Then, we generate the formats for luatex:
luatools --ini --verbose --compile cont-en
Again, many lines of output, among those the confirmation that the
formats have
been built and installed:
LuaTools | creating initialization file cont-en
LuaTools | using library path : /usr/local/texlive/texmf-local/tex/
context/base
LuaTools | using lua libraries: l-string.lua l-table.lua l-
boolean.lua l-number.lua l-unicode.lua l-md5.lua l-os.lua l-io.lua l-
file.lua l-dir.lua l-utils.lua l-tex.lua luat-lib.lua luat-inp.lua
luat-tmp.lua luat-zip.lua luat-tex.lua
LuaTools | using compiled initialization file cont-en.luc
LuaTools | using lua initialization file cont-en.luc
LuaTools | running command: luatex --ini --lua="cont-en.luc" "/usr/
local/texlive/texmf-local/tex/context/base/cont-en.tex" \dump
This is luaTeX, Version 3.141592-beta-0.11.2-2007091918 (Web2C 7.5.6)
(INITEX)
[snip]
ConTeXt ver: 2007.09.28 16:52 MKIV fmt: 2007.10.2 int: english/
english
lua : used config path - /usr/local/texlive/2007/texmf/web2c
lua : used cache path - /tmp/luatex-cache/context/
6da32d2ec193ac6d2428d020ce069374
)
Beginning to dump on file cont-en.fmt
(format=cont-en 2007.10.2)
And that's it! Now you can create your first test file and typeset it
with
luatex:
texmfstart texexec --luatex test.tex