Difference between revisions of "Installing ConTeXt LMTX on MacOS"

From Wiki
Jump to navigation Jump to search
m (NeueDarshan moved page installing luametatex to Installing ConTeXt LMTX on MacOS: More specific & accurate title)
(Restructured & improved readability (by SublimeText.Mediawiker))
Line 1: Line 1:
Since April 2019, there is a new flavor of ConTeXt, named « LuaMetaTeX » meant to integrate Lua, Metapost and TeX, the latter meaning ConTeXt.
+
Since a few users have encountered difficulties in installing, and updating to, beta releases of ConTeXt LMTX on macOS, below we describe an installation procedure for macOS. For other platforms the procedures are more or less analogous.
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 [http://www.pragma-ade.com/install.htm] where you can find the installer script for the machine you are using.
+
== Installing LMTX on macOS up to 10.14 ==
  
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.
+
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).
  
 +
First download the LMTX zip from the "64 bit Mac OSX" link at http://www.pragma-ade.com/install.htm. Put the unzipped folder {{code|context-osx-64/}} wherever you wish—for instance, in your home directory. Thus the path to your future LMTX directory will be {{code|'''~/context-osx-64/'''}} (from now on, this is what we assume).
  
== Installing on MacOS up to 10.14 ==
+
Open a Terminal window ({{code|Terminal.app}} is found in {{code|/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 {{code|mtxrun}} script which is called by {{code|install.sh}}. In that case, you should open System Preferences (from the Apple menu) and choose Security & Privacy, then go to the General pane. There you should be able to authorize the shell script, which has been blocked, to be executed. When you issue the command again, macOS will ask you whether you really want to execute it.
  
* '''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
+
After that, if everything goes smoothly, a complete functioning tree of LMTX, complete with dozens of manuals, will be installed in {{code|'''~/context-osx-64/'''}}. Whenever you want to update your installation of LMTX, it is enough to go to that directory in Terminal & run the installation script again:
 +
sh install.sh
  
* First download http://lmtx.pragma-ade.nl/install-lmtx/context-osx-64.zip
+
== Installing LMTX 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)
+
First obtain a complete tree of {{code|context-osx-64/}} that works on macOS 10.14 or previous, from someone you know. You can always contact the ConTeXt mailing list & ask for this from someone (one day there might be a direct distribution of this zip file). If you yourself have access to macOS 10.14 or previous, you can follow [[#Installing LMTX on macOS up to 10.14|the instructions above]] & create a {{code|context-osx-64/}} tree, then copy that tree on a USB memory stick & transfer it to your macOS 10.15. In this case, you should wipe the {{code|tex/texmf-cache/}} folder in the copy intended for macOS 10.15.
~/context-osx-64/
 
  
* Open a Terminal window (Terminal.app is found in /Applications/Utilities). In the Terminal window type
+
Disable the SIP (System Integrity Protection), following the instructions given [https://www.macworld.co.uk/how-to/mac/how-turn-off-mac-os-x-system-integrity-protection-rootless-3638975/ here], for example. Later, you can restore the SIP, once the installation of LMTX is over.
cd ~/context-osx-64/
 
  
* Then you should be able to execute the command
+
In a Terminal window, reinstate the Anywhere option in Gatekeeper (visible in Apple menu -> Preferences -> Security & Privacy) by typing:
  sh install.sh
+
sudo spctl --master-disable
 +
Later, you can put back the Gatekeeper default by saying
 +
  sudo spctl --master-enable
 +
once the installation of LMTX is over.
 +
 
 +
Restart your Mac and put the folder {{code|context-osx-64/}} wherever you wish—for instance, in your home directory. Thus the path to your future LuaMetaTeX directory will be {{code|'''~/context-osx-64/'''}}.
  
* 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
+
At this point, you may enable SIP and Gatekeeper again.
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
+
In order to update to the latest version of LuaMetaTeX, in a Terminal run:
  ~/context-osx-64/
+
  cd '''~/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
 
  sh install.sh
 +
The update should go ahead without any interference from Gatekeeper or SIP, even if you have reverted them to their default settings.
  
* If you want to use LuaMetaTeX from the Terminal interface you should add the path of your installation to $PATH by adding to your
+
== Running LMTX from the Terminal ==
.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 [https://pages.uoregon.edu/koch/texshop/obtaining.html]. Once TeXShop is installed, go to
+
If you want to run LMTX from the Terminal interface in any directory, you should add the path of your installation to $PATH by adding this to your {{code|.bashrc}} (or another configuration file, depending on your flavor of shell interface):
~/Library/TeXShop/Engine
+
  export PATH=$PATH:'''~/context-osx-64/'''bin:'''~/context-osx-64/'''tex/texmf-osx-64/bin
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
+
''Reminder: if you have installed {{code|context-osx-64/}} elsewhere, please replace the segment {{code|'''~/context-osx-64/'''}} in the above code with the path to that directory.''
LuaMetaTeX
 
  
* In principle, once the above PATH has been added, typing in a Terminal window
+
In principle, once your PATH has been modified, typing in a Terminal window
 
  which context
 
  which context
 
or  
 
or  
 
  context --version
 
  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:
+
you should get the path to the ConTeXt binary and its version. If this is the case, then you can typeset a file named {{code|myfile.tex}} from the Terminal by typing:
 
  context myfile.tex
 
  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:
+
----
 +
 
 +
It may happen that for some reason not everything goes smoothly & you cannot typeset any document. In that case, try typing in a Terminal window:
 
  which luametatex
 
  which luametatex
in order to see whether
+
in order to see whether {{code|'''~/context-osx-64/'''tex/texmf-osx-64/bin/luametatex}} is present or not. If not, the download is incomplete.
~/context-osx-64/tex/texmf-osx-64/bin/luametatex
 
is present or not.
 
  
* If not, the download has not been complete.
+
If {{code|luametatex}} is present, in the Terminal type:
 
 
* If luametatex is present, in the Terminal type:
 
 
  luametatex --version
 
  luametatex --version
 
and see whether it says, among other things:
 
and see whether it says, among other things:
 
  Functionality : level 20191206
 
  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.
+
(here {{code|20191206}} is the date stamp of {{code|luametatex}}; this will change over time, of course). If not, there might be an issue with the files you have downloaded.
  
* If yes, in the folder
+
If there is no issue, in {{code|'''~/context-osx-64/'''tex/}}, remove the directory {{code|texmf-cache/}}, then in the Terminal run:
~/context-osx-64/tex
 
remove the folder « texmf-cache » and then in the Terminal run:
 
 
  mtxrun --generate
 
  mtxrun --generate
In principle, after that, the folder texmf-cache is present again.
+
After that, in principle, the directory {{code|texmf-cache/}} should be present again.
  
* If this is the case, in the Terminal window type:
+
If this is the case, in the Terminal window type:
 
  context --make --all
 
  context --make --all
If everything goes nicely, you should be able to see LuaMetaTeX functionning.
+
If everything goes nicely, you should be able to see LMTX functioning.
  
== Installing on MacOS 10.15 Catlina ==
+
== Running LMTX from TeXShop ==
  
* First get your hands on a zip file of a complete tree of
+
Alternatively, you could use a TeX editor such as [https://pages.uoregon.edu/koch/texshop/obtaining.html TeXShop]. Once TeXShop is installed, go to {{code|~/Library/TeXShop/Engine/}}, create a new file named {{code|ConTeXt LMTX.engine}}, open it in your preferred text editor, and add the following lines:
context-osx-64
+
#!/bin/bash
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
+
export PATH=$PATH:'''~/context-osx-64/'''bin:'''~/context-osx-64/'''tex/texmf-osx-64/bin
context-osx-64/tex/texmf-cache
+
'''~/context-osx-64/'''tex/texmf-osx-64/bin/mtxrun --autogenerate --script context --directives="system.showerror" --autopdf "$1" --purgeall
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
+
''Reminder: if you have installed {{code|context-osx-64/}} elsewhere, please replace the segment {{code|'''~/context-osx-64/'''}} in the above code with the path to that directory.)''
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)
+
Save & close the file.  
~/context-osx-64/
 
  
* In a Terminal window export the PATH
+
If you want to use LMTX as your default TeX typesetter in TeXShop, go to TeXShop -> Preferences, then under the tab Typesetting, in the Default Command section, choose the radio button "Command listed below", then type {{code|ConTeXt LMTX}} below that.
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.
 

Revision as of 21:20, 6 February 2020

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

Installing LMTX on macOS up to 10.14

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).

First download the LMTX zip from the "64 bit Mac OSX" link at http://www.pragma-ade.com/install.htm. Put the unzipped folder context-osx-64/ wherever you wish—for instance, in your home directory. Thus the path to your future LMTX directory will be ~/context-osx-64/ (from now on, this is what we assume).

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 System Preferences (from the Apple menu) and choose Security & Privacy, then go to the General pane. There you should be able to authorize the shell script, which has been blocked, to be executed. When you issue the command again, macOS will ask you whether you really want to execute it.

After that, if everything goes smoothly, a complete functioning tree of LMTX, complete with dozens of manuals, will be installed in ~/context-osx-64/. Whenever you want to update your installation of LMTX, it is enough to go to that directory in Terminal & run the installation script again:

sh install.sh

Installing LMTX on macOS 10.15 Catalina

First obtain a complete tree of context-osx-64/ that works on macOS 10.14 or previous, from someone you know. You can always contact the ConTeXt mailing list & ask for this from someone (one day there might be a direct distribution of this zip file). If you yourself have access to macOS 10.14 or previous, you can follow the instructions above & create a context-osx-64/ tree, then copy that tree on a USB memory stick & transfer it to your macOS 10.15. In this case, you should wipe the tex/texmf-cache/ folder in the copy intended for macOS 10.15.

Disable the SIP (System Integrity Protection), following the instructions given here, for example. Later, you can restore the SIP, once the installation of LMTX is over.

In a Terminal window, reinstate the Anywhere option in Gatekeeper (visible in Apple menu -> Preferences -> Security & Privacy) by typing:

sudo spctl --master-disable

Later, you can put back the Gatekeeper default by saying

sudo spctl --master-enable

once the installation of LMTX 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 ~/context-osx-64/.

At this point, you may enable SIP and Gatekeeper again.

In order to update to the latest version of LuaMetaTeX, in a Terminal run:

cd ~/context-osx-64/
sh install.sh

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

Running LMTX from the Terminal

If you want to run LMTX from the Terminal interface in any directory, you should add the path of your installation to $PATH by adding this to your .bashrc (or another configuration file, depending on your flavor of shell interface):

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

Reminder: if you have installed context-osx-64/ elsewhere, please replace the segment ~/context-osx-64/ in the above code with the path to that directory.

In principle, once your PATH has been modified, typing in a Terminal window

which context

or

context --version

you should get the path to the 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 reason not everything goes smoothly & 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 is incomplete.

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; this will change over time, of course). If not, there might be an issue with the files you have downloaded.

If there is no issue, in ~/context-osx-64/tex/, remove the directory texmf-cache/, then in the Terminal run:

mtxrun --generate

After that, in principle, the directory texmf-cache/ should be 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 LMTX functioning.

Running LMTX from TeXShop

Alternatively, you could use a TeX editor such as TeXShop. Once TeXShop is installed, go to ~/Library/TeXShop/Engine/, create a new file named ConTeXt LMTX.engine, open it in your preferred text editor, and add the following lines:

#!/bin/bash
export PATH=$PATH:~/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

Reminder: if you have installed context-osx-64/ elsewhere, please replace the segment ~/context-osx-64/ in the above code with the path to that directory.)

Save & close the file.

If you want to use LMTX as your default TeX typesetter in TeXShop, go to TeXShop -> Preferences, then under the tab Typesetting, in the Default Command section, choose the radio button "Command listed below", then type ConTeXt LMTX below that.