Installing ConTeXt LMTX on MacOS

From Wiki
Revision as of 08:36, 13 December 2019 by Otared (talk | contribs)
Jump to navigation Jump to search

Since April 2019, there is a new flavor of ConTeXt, named « LuaMetaTeX » meant to integrate Lua, Metapost and TeX, the latter meaning ConTeXt. It is going to be self-contained and smaller than previous versions of ConTeXt mkiv and mkii.

See http://www.pragma-ade.com/install.htm [1] where you can find the installer script for the machine you are using.

Since a few users have encountered difficulties in installing, and updating to, beta releases of LuaMetaTeX on MacOS, below we describe an installtion procedure for MacOS. For other platforms the procedures are more or less analogous.


Installing on MacOS up to 10.14

  • Beware: As of December 2019, the following instructions work for MacOS up to version 10.14 but do not work for MacOS 10.15 Catalina, due to the Apple's System Integrity Protection (SIP). Please see the dedicated section for installing on MacOS 10.15 Catalina
  • Put the unzipped folder « context-osx-64 « wherever you wish: for instance in your home directory. Thus the path to your future LuaMetaTeX directory will be (and below this is what we assume)
~/context-osx-64/
  • Open a Terminal window (Terminal.app is found in /Applications/Utilities). In the Terminal window type
cd ~/context-osx-64/
  • Then you should be able to execute the command
sh install.sh
  • It may happen that MacOS will not allow you to execute the above shell command, or the mtxrun script which is called by install.sh. In that case, you should open the System Préferences (from the Apple menu) and there choose Security & Privacy, and go to the General pane. There you should be able to authorize the shell script, which has been blocked, to be executed. After that you issue again the command
sh install.sh

and MacOS will ask you again whether you really want to execute mtxrun: you say YES!

  • After that, if everything goes smoothly a complete functionning tree of LuaMetaTeX, complete with dozens of manuals, will be installed in the folder
~/context-osx-64/

and whenever you want to update your installation of LuaMetaTeX, it is enough to go to the above directory in Terminal and do again

sh install.sh
  • If you want to use LuaMetaTeX from the Terminal interface you should add the path of your installation to $PATH by adding to your
.bashrc

(or any other flavor of shell interface you are using) the line

export PATH=~/context-osx-64/tex/texmf-osx-64/bin:~/context-osx-64/bin:~/context-osx-64/tex/texmf-osx-64/bin:$PATH

(if you have installed « context-osx-64 » elsewhere, please replace the segment « ~/context-osx-64 » with the path to that folder).

  • A better choice is to use TeXShop [2]. Once TeXShop is installed, go to
~/Library/TeXShop/Engine

and there duplicate for instance the file « ConTeXt (LuaTeX).engine » (or any other of the files « .engine »). Name the duplicate

LuaMetaTeX.engine

and open it in TeXShop (or any text editor). Replace the content of the file « LuaMetaTeX.engine » with the following lines:

#!/bin/bash
export PATH=~/context-osx-64/tex/texmf-osx-64/bin:~/context-osx-64/bin:~/context-osx-64/tex/texmf-osx-64/bin
~/context-osx-64/tex/texmf-osx-64/bin/mtxrun --autogenerate --script context --directives="system.showerror" --autopdf "$1" --purgeall

then save and close the file.

  • If you want to use LuaMetaTeX as your default TeX typesetter in TeXShop, go to TeXShop -> Preferences, then under the tab « Typesetting » and the « Default Command » section choose the radio button « Command listed below « and below that type
LuaMetaTeX
  • In principle, once the above PATH has been added, typing in a Terminal window
which context

or

context --version

you should get the path to context binary and its version. If this is the case, then you can typeset a file named « myfile.tex » from the Terminal by typing:

context myfile.tex
  • It may happen that for some reasons not everything goes smoothly and you cannot typeset any document. In that case, try typing in a Terminal window:
which luametatex

in order to see whether

~/context-osx-64/tex/texmf-osx-64/bin/luametatex

is present or not.

  • If not, the download has not been complete.
  • If luametatex is present, in the Terminal type:
luametatex --version

and see whether it says, among other things:

Functionality : level 20191206

(here 20191206 is the date stamp of luametatex, of course this will change during time). If not, there might be an issue with the files you have downloaded.

  • If yes, in the folder
~/context-osx-64/tex

remove the folder « texmf-cache » and then in the Terminal run:

mtxrun --generate

In principle, after that, the folder texmf-cache is present again.

  • If this is the case, in the Terminal window type:
context --make --all

If everything goes nicely, you should be able to see LuaMetaTeX functionning.

Installing on MacOS 10.15 Catlina

  • First get your hands on a zip file of a complete tree of
context-osx-64

which works on MacOS 10.14 or previous, from someone you know... You can always contact the ConTeXt mailing list and ask this from someone (one day there might be a direct distribution of this zip file). If you have yourself access to a MacOS less than or equal to 10.14, you can follow the instructions above, create a context-osx-64 tree, and then copy that tree on a USB memory stick and transfer it to your MacOS 10.15. In thi scase you should wipe the

context-osx-64/tex/texmf-cache

folder in your copy destined to MacOS 10.15.

  • Disable the SIP (System Integrity Protection) following (for example) the instructions given here
 https://www.macworld.co.uk/how-to/mac/how-turn-off-mac-os-x-system-integrity-protection-rootless-3638975/

Later, you can put back the SIP, once the installation of LuaMetaTeX is over.

  • In a Terminal window, reinstate the « Anywhere » option in Gatekeeper (which is visible in the Apple menu -> Préferences -> Security & Privacy) by doing
sudo spctl --master-disable

Later, you can put back the Gatekeeper default by saying

sudo spctl --master-enable

once the installation of LuaMetaTeX is over.

  • Restart your Mac and put the folder « context-osx-64 « wherever you wish: for instance in your home directory. Thus the path to your future LuaMetaTeX directory will be (and below this is what we assume)
~/context-osx-64/
  • In a Terminal window export the PATH
export PATH=~/context-osx-64/tex/texmf-osx-64/bin:~/context-osx-64/bin:~/context-osx-64/tex/texmf-osx-64/bin:$PATH

You can add this path to your .zshrc or .bashrc if you wish to use LuaMetaTeX from everywhere on your Mac.

  • You can test your installation by saying in the Terminal window
which luametatex

and see whether it points to something in your context-osx-64 tree.

  • In the Terminal window run
mtxrun --generate

and next

context --make --all
  • Now in principle you are done and you can typeset a test file named » mytest.tex » by saying
context mytest.tex
  • At this point, you can enable again SIP and Gatekeeper as indicated above.
  • In order to update to the latest version of LuaMetaTeX in a Terminal do
cd ~/context-osx-64/
sh install.sh

The update should go ahead without any interference from Gatekeeper or SIP, even if you have trurned them to their default settings.