Difference between revisions of "ConTeXt Standalone/Mac Installation"

From Wiki
Jump to navigation Jump to search
m (set PATH instead of sourcing setuptex)
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
< [[ConTeXt Minimals]]
+
< [[ConTeXt Standalone]]
  
This page describes an '''alternative''' of installing [[ConTeXt Minimals]] on Mac OS X. In particular it describes how to configure some GUI applications to work well with minimals.
+
This page describes an '''alternative''' of installing [[ConTeXt Standalone]] on Mac OS X. In particular it describes how to configure some GUI applications to work well with standalone.
  
(It is '''enough''' to follow the steps described in [[ConTeXt Minimals]]. Some instructions on this page may cause difficulties that are hard to overcome.)
+
(It is '''enough''' to follow the steps described in [[ConTeXt Standalone]]. Some instructions on this page may cause difficulties that are hard to overcome.)
  
 
==Mac newbie installation and configuration==
 
==Mac newbie installation and configuration==
  
 
The following assumes that you want to use ConTeXt and you are a not inside UNIX world (otherwise, see before and after).  
 
The following assumes that you want to use ConTeXt and you are a not inside UNIX world (otherwise, see before and after).  
It guides you to install ConTeXt minimal installation under Mac in the typical Applications folder. Then it gives you some information
+
It guides you to install ConTeXt standalone installation under Mac in the typical Applications folder. Then it gives you some information
 
about how to configure [http://smultron.sourceforge.net/ Smultron] and [http://www.uoregon.edu/~koch/texshop/obtaining.html TeXShop] to work as an editor for ConTeXt.
 
about how to configure [http://smultron.sourceforge.net/ Smultron] and [http://www.uoregon.edu/~koch/texshop/obtaining.html TeXShop] to work as an editor for ConTeXt.
 
Smultron is a Mac-only, open source text editor which is very easy to use and at the same time powerful (see also [http://en.wikipedia.org/wiki/Smultron]).
 
Smultron is a Mac-only, open source text editor which is very easy to use and at the same time powerful (see also [http://en.wikipedia.org/wiki/Smultron]).
Line 14: Line 14:
 
===ConTeXt installation===
 
===ConTeXt installation===
  
1. Create a folder inside the Applications folder (in the Finder, press Command-Shift-A, Command-Shift-N) and name it “ConTeXtMinimals”
+
1. Create a folder inside the Applications folder (in the Finder, press Command-Shift-A, Command-Shift-N) and name it “ConTeXtStandalone”
  
 
(BEWARE: Installing in the Applications folder may cause permission problems!)
 
(BEWARE: Installing in the Applications folder may cause permission problems!)
Line 21: Line 21:
  
 
3. Type this:  
 
3. Type this:  
<code> cd /Applications/ConTeXtMinimals </code>,  
+
<code> cd /Applications/ConTeXtStandalone </code>,  
which means “change directory to ConTeXtMinimals”. Now you are working in the folder you have just created.
+
which means “change directory to ConTeXtStandalone”. Now you are working in the folder you have just created.
  
 
4. Type this:  
 
4. Type this:  
Line 30: Line 30:
 
This calls <code> rsync</code>, a program which goes to the contextgarden site (--> you must be connected to internet) and downloads the denoted file(s). To start, it simply downloads the little file <code> first-setup.sh</code>: this shell script contains a set of instructions which allow for automatic downloads (e.g., it selects the right files depending on which platform you are).
 
This calls <code> rsync</code>, a program which goes to the contextgarden site (--> you must be connected to internet) and downloads the denoted file(s). To start, it simply downloads the little file <code> first-setup.sh</code>: this shell script contains a set of instructions which allow for automatic downloads (e.g., it selects the right files depending on which platform you are).
  
To get the rest of the ConTeXt minimals, you have to execute this script by typing in Terminal  
+
To get the rest of the ConTeXt standalone, you have to execute this script by typing in Terminal  
 
<code>./first-setup.sh</code>.  
 
<code>./first-setup.sh</code>.  
  
This will start the download and install process. Now (well, after a while) you have all the required files in the /Applications/ConTeXtMinimals folder.
+
This will start the download and install process. Now (well, after a while) you have all the required files in the /Applications/ConTeXtStandalone folder.
  
 
===Configuring ConTeXT===
 
===Configuring ConTeXT===
  
 
1. Open a text editor and create a file that has in it the following line:  
 
1. Open a text editor and create a file that has in it the following line:  
<code>. /Applications/ConTeXtMinimals/tex/setuptex /Applications/ConTeXtMinimals/tex</code>.  
+
<code>. /Applications/ConTeXtStandalone/tex/setuptex /Applications/ConTeXtStandalone/tex</code>.  
 
Save this file as “.bash_profile” (see '''Where to put files''', below).  (BEWARE: That might overwrite an existing .bash_profile!)
 
Save this file as “.bash_profile” (see '''Where to put files''', below).  (BEWARE: That might overwrite an existing .bash_profile!)
  
Line 45: Line 45:
 
(There is a small utility for working with hidden files on the Mac called "Show/Hide Invisible Files": it is available at  <code>http://www.macupdate.com/info.php/id/22318</code>.)You can find out more on [http://www.mac-how.net/ how to view hidden files on mac] on the official site of MacHow.
 
(There is a small utility for working with hidden files on the Mac called "Show/Hide Invisible Files": it is available at  <code>http://www.macupdate.com/info.php/id/22318</code>.)You can find out more on [http://www.mac-how.net/ how to view hidden files on mac] on the official site of MacHow.
  
2. Create a new folder named “texmf-local” inside ConTeXtMinimals/tex.
+
2. Create a new folder named “texmf-local” inside ConTeXtStandalone/tex.
  
 
3. Create another folder “web2c” inside this texmf-local folder.
 
3. Create another folder “web2c” inside this texmf-local folder.
 
   
 
   
4. Inside your ConTeXtMinimals folder, locate the file named <code>texmf.cnf</code> that is in tex/texmf/web2c. Copy this file to ConTeXtMinimals/tex/texmf-local/web2c. Open this new texmf.cnf file, find the line
+
4. Inside your ConTeXtStandalone folder, locate the file named <code>texmf.cnf</code> that is in tex/texmf/web2c. Copy this file to ConTeXtStandalone/tex/texmf-local/web2c. Open this new texmf.cnf file, find the line
  
 
TEXMFHOME    = /nonexist  
 
TEXMFHOME    = /nonexist  
Line 95: Line 95:
 
3. The resulting window allows you to define some commands which can be executed by Smultron. Substantially, this means that Smultron opens for you a Terminal, types the code you want and presses return.
 
3. The resulting window allows you to define some commands which can be executed by Smultron. Substantially, this means that Smultron opens for you a Terminal, types the code you want and presses return.
  
4. Create a new command by pressing the "New Command" button and type a name (e.g. "minimalsTexexec"). Then, write in the text field at the bottom:
+
4. Create a new command by pressing the "New Command" button and type a name (e.g. "standaloneTexexec"). Then, write in the text field at the bottom:
  
 
<pre>
 
<pre>
#!/bin/sh
+
#!/bin/bash
 
+
export PATH=/Applications/ConTeXtStandalone/tex/texmf-osx-64/bin:$PATH
cd /Applications/ConTeXtMinimals/
 
. /Applications/ConTeXtMinimals/tex/setuptex /Applications/ConTeXtMinimals/tex
 
cd %%d
 
 
texexec %%p
 
texexec %%p
 
</pre>
 
</pre>
Line 109: Line 106:
 
Now Smultron can do it for you.
 
Now Smultron can do it for you.
  
5. Write your ConTeXt file with Smultron and save it. When you want to compile it, simply go under Tools-->Commands-->Other-->minimalsTexexec. This will generate a pdf file in the same folder of your .tex file.
+
5. Write your ConTeXt file with Smultron and save it. When you want to compile it, simply go under Tools-->Commands-->Other-->standaloneTexexec. This will generate a pdf file in the same folder of your .tex file.
  
6. If you want to experiment with LuaTeX (ConTeXt MkIV) simply add another command (you can name it e.g. "minimalsLua") with this text in its text field:
+
6. If you want to experiment with LuaTeX (ConTeXt MkIV) simply add another command (you can name it e.g. "standaloneLua") with this text in its text field:
  
 
<pre>
 
<pre>
#!/bin/sh
+
#!/bin/bash
cd /Applications/ConTeXtMinimals/
+
export PATH=/Applications/ConTeXtStandalone/tex/texmf-osx-64/bin:$PATH
. /Applications/ConTeXtMinimals/tex/setuptex /Applications/ConTeXtMinimals/tex
 
cd %%d
 
 
context %%p
 
context %%p
 
</pre>
 
</pre>
Line 127: Line 122:
 
7. If you want an automatic update of the pdf you are workin on you can use another mac app, [http://pdfview.sourceforge.net/ pdfview]. You have simply to install it, open your pdf file and choose the automatic update option. Every time you recompile form Smultron (or by another editor), it updates the displayed pdf
 
7. If you want an automatic update of the pdf you are workin on you can use another mac app, [http://pdfview.sourceforge.net/ pdfview]. You have simply to install it, open your pdf file and choose the automatic update option. Every time you recompile form Smultron (or by another editor), it updates the displayed pdf
  
Here we are not using the famous TeXShop editor, because it is slightly more complicated, and typically you grab it bundled with a TeX distribution (like MacTeX), and opportunely configured. By using Smultron, we have created a completely autonomous and lightweight ConTeXTMinimals installation which can work aside MacTeX/TeXShop installation. More, by pdfview we have auto update, which is one of the very relevant feature of TeXShop (If you do not know about all this stuff, see [http://wiki.contextgarden.net/Mac_Installation Mac installation]
+
Here we are not using the famous TeXShop editor, because it is slightly more complicated, and typically you grab it bundled with a TeX distribution (like MacTeX), and opportunely configured. By using Smultron, we have created a completely autonomous and lightweight ConTeXTStandalone installation which can work aside MacTeX/TeXShop installation. More, by pdfview we have auto update, which is one of the very relevant feature of TeXShop (If you do not know about all this stuff, see [http://wiki.contextgarden.net/Mac_Installation Mac installation]
  
 
===TeXShop installation and configuration===
 
===TeXShop installation and configuration===
Line 133: Line 128:
 
TeXShop is a popular TeX editor for Mac OS X.
 
TeXShop is a popular TeX editor for Mac OS X.
  
1.  To install it, download the disk image from <code>http://www.uoregon.edu/~koch/texshop/obtaining.html</code> and put this app in the Applications folder alongside your ConTeXTMinimals folder.
+
1.  To install it, download the disk image from <code>http://www.uoregon.edu/~koch/texshop/obtaining.html</code> and put this app in the Applications folder alongside your ConTeXTStandalone folder.
  
 
2. Launch TeXShop. It will automatically create the necessary support files.  
 
2. Launch TeXShop. It will automatically create the necessary support files.  
Line 140: Line 135:
 
<pre>  
 
<pre>  
 
#!/bin/bash
 
#!/bin/bash
export PATH=/Applications/ConTeXtMinimals/tex/texmf-osx-intel/bin:$PATH
+
export PATH=/Applications/ConTeXtStandalone/tex/texmf-osx-intel/bin:$PATH
 
texexec "$1"
 
texexec "$1"
 
</pre>
 
</pre>
Line 149: Line 144:
 
<pre>
 
<pre>
 
#!/bin/bash
 
#!/bin/bash
export PATH=/Applications/ConTeXtMinimals/tex/texmf-osx-intel/bin:$PATH
+
export PATH=/Applications/ConTeXtStandalone/tex/texmf-osx-64/bin:$PATH
export TEXMFCACHE=/Applications/ConTeXtMinimals/tex/texmf-cache
+
export TEXMFCACHE=/Applications/ConTeXtStandalone/tex/texmf-cache
 
context "$1"
 
context "$1"
 
</pre>
 
</pre>
 +
 +
Please note that the directory might be called texmf-osx-64 on your computer.
  
 
6. Repeat steps 3 and 4 once more, by creating a file named “ConTeXt-XeTeX.engine” that contains the lines:
 
6. Repeat steps 3 and 4 once more, by creating a file named “ConTeXt-XeTeX.engine” that contains the lines:
 
<pre>
 
<pre>
 
#!/bin/bash
 
#!/bin/bash
export PATH=/Applications/ConTeXtMinimals/tex/texmf-osx-intel/bin:$PATH
+
export PATH=/Applications/ConTeXtStandalone/tex/texmf-osx-64/bin:$PATH
 
texexec --xtx "$1"
 
texexec --xtx "$1"
 
</pre>
 
</pre>

Latest revision as of 12:55, 8 January 2014

< ConTeXt Standalone

This page describes an alternative of installing ConTeXt Standalone on Mac OS X. In particular it describes how to configure some GUI applications to work well with standalone.

(It is enough to follow the steps described in ConTeXt Standalone. Some instructions on this page may cause difficulties that are hard to overcome.)

Mac newbie installation and configuration

The following assumes that you want to use ConTeXt and you are a not inside UNIX world (otherwise, see before and after). It guides you to install ConTeXt standalone installation under Mac in the typical Applications folder. Then it gives you some information about how to configure Smultron and TeXShop to work as an editor for ConTeXt. Smultron is a Mac-only, open source text editor which is very easy to use and at the same time powerful (see also [1]).

ConTeXt installation

1. Create a folder inside the Applications folder (in the Finder, press Command-Shift-A, Command-Shift-N) and name it “ConTeXtStandalone”

(BEWARE: Installing in the Applications folder may cause permission problems!)

2. Open a Terminal window (i.e., open the Terminal.app in your Utilities folder: a little window pops up)

3. Type this: cd /Applications/ConTeXtStandalone , which means “change directory to ConTeXtStandalone”. Now you are working in the folder you have just created.

4. Type this: rsync -ptv rsync://contextgarden.net/minimals/setup/first-setup.sh . and press Return.

This calls rsync, a program which goes to the contextgarden site (--> you must be connected to internet) and downloads the denoted file(s). To start, it simply downloads the little file first-setup.sh: this shell script contains a set of instructions which allow for automatic downloads (e.g., it selects the right files depending on which platform you are).

To get the rest of the ConTeXt standalone, you have to execute this script by typing in Terminal ./first-setup.sh.

This will start the download and install process. Now (well, after a while) you have all the required files in the /Applications/ConTeXtStandalone folder.

Configuring ConTeXT

1. Open a text editor and create a file that has in it the following line: . /Applications/ConTeXtStandalone/tex/setuptex /Applications/ConTeXtStandalone/tex. Save this file as “.bash_profile” (see Where to put files, below). (BEWARE: That might overwrite an existing .bash_profile!)

Note: this file will be hidden, so make sure that you save it in the right place before completing the SAVE command.

(There is a small utility for working with hidden files on the Mac called "Show/Hide Invisible Files": it is available at http://www.macupdate.com/info.php/id/22318.)You can find out more on how to view hidden files on mac on the official site of MacHow.

2. Create a new folder named “texmf-local” inside ConTeXtStandalone/tex.

3. Create another folder “web2c” inside this texmf-local folder.

4. Inside your ConTeXtStandalone folder, locate the file named texmf.cnf that is in tex/texmf/web2c. Copy this file to ConTeXtStandalone/tex/texmf-local/web2c. Open this new texmf.cnf file, find the line

TEXMFHOME = /nonexist

and replace it with the single line

TEXMFHOME = ~/texmf

(WHY? Just use the newly created texmf-local and forget about the following steps! HrabanHraban)

Again, replace the line

TEXMF = {!!$TEXMFPROJECT,!!$TEXMFFONTS,!!$TEXMFLOCAL,!!$TEXMFCONTEXT,!! with the single line

TEXMF = {$TEXMFHOME,!!$TEXMFPROJECT,!!$TEXMFFONTS,!!$TEXMFLOCAL,!!$TEXMFCONTEXT,!!$TEXMFEXTRA,!!$TEXMFMAIN}

(See Where to put files below. These instructions assume that your personal texmf folder is in your Home folder. If you want it elsewhere, be sure to adjust the instructions in section 4 above accordingly.)

5. In Terminal, type luatools --generate and press Enter/Return.

6. In Terminal, type context --make and press Enter/Return.

Where to put files

.bash_profile

There are several places that this file may go. One possibility is in your Home folder. You can also use the name ".profile".

personal texmf

Put your personal texmf folder where it will not get clobbered by future updates. Some possibilities:

(a) inside your Home folder. (Your Home folder is the one that has the house icon.)

(b) inside the Library folder in your Home folder.

Smultron installation and configuration

1. Smultron is a Mac application. To install it, simply download the dmg and put the app under the Applications folder (as usual)

2. Open Smultron and go under Tools-->Handle Commands-->Show Commands Window

3. The resulting window allows you to define some commands which can be executed by Smultron. Substantially, this means that Smultron opens for you a Terminal, types the code you want and presses return.

4. Create a new command by pressing the "New Command" button and type a name (e.g. "standaloneTexexec"). Then, write in the text field at the bottom:

#!/bin/bash 
export PATH=/Applications/ConTeXtStandalone/tex/texmf-osx-64/bin:$PATH
texexec %%p

texexec is the command you should call from the Terminal to run ConTeXt. Now Smultron can do it for you.

5. Write your ConTeXt file with Smultron and save it. When you want to compile it, simply go under Tools-->Commands-->Other-->standaloneTexexec. This will generate a pdf file in the same folder of your .tex file.

6. If you want to experiment with LuaTeX (ConTeXt MkIV) simply add another command (you can name it e.g. "standaloneLua") with this text in its text field:

#!/bin/bash
export PATH=/Applications/ConTeXtStandalone/tex/texmf-osx-64/bin:$PATH
context %%p

6b. If you explore the Commands window, you will see that clicking under the Shortcut tab you can insert a shortcut.

6c. If you want to see what ConTeXt is telling you (which is fundamental in case of unexpected behaviors) you can select Tools-->Handle Commands-->Show Command Result Window. This will open a window mirroring the content of the Terminal (i.e. what ConTeXt is communicating you)

7. If you want an automatic update of the pdf you are workin on you can use another mac app, pdfview. You have simply to install it, open your pdf file and choose the automatic update option. Every time you recompile form Smultron (or by another editor), it updates the displayed pdf

Here we are not using the famous TeXShop editor, because it is slightly more complicated, and typically you grab it bundled with a TeX distribution (like MacTeX), and opportunely configured. By using Smultron, we have created a completely autonomous and lightweight ConTeXTStandalone installation which can work aside MacTeX/TeXShop installation. More, by pdfview we have auto update, which is one of the very relevant feature of TeXShop (If you do not know about all this stuff, see Mac installation

TeXShop installation and configuration

TeXShop is a popular TeX editor for Mac OS X.

1. To install it, download the disk image from http://www.uoregon.edu/~koch/texshop/obtaining.html and put this app in the Applications folder alongside your ConTeXTStandalone folder.

2. Launch TeXShop. It will automatically create the necessary support files.

3. Create an empty text document with your favorite text editor or TeXShop. Then, insert the following text into the document:

 
#!/bin/bash
export PATH=/Applications/ConTeXtStandalone/tex/texmf-osx-intel/bin:$PATH
texexec "$1"

4. SAVE this document in your Home folder in “Library/TeXShop/Engines/” AS “ConTeXt-MKII.engine”. (TeXShop offers the .engine file format). After you have saved the file, open Terminal, navigate to /Library/TeXShop/Engines in your Home folder using cd ~/Library/TeXShop/Engines/. Then, run chmod +x ConTeXt-MKII.engine .


5. Repeat steps 3 and 4, by creating a file named “ConTeXt-MKIV.engine” that contains the lines:

#!/bin/bash
export PATH=/Applications/ConTeXtStandalone/tex/texmf-osx-64/bin:$PATH
export TEXMFCACHE=/Applications/ConTeXtStandalone/tex/texmf-cache
context "$1"

Please note that the directory might be called texmf-osx-64 on your computer.

6. Repeat steps 3 and 4 once more, by creating a file named “ConTeXt-XeTeX.engine” that contains the lines:

#!/bin/bash
export PATH=/Applications/ConTeXtStandalone/tex/texmf-osx-64/bin:$PATH
texexec --xtx "$1"

Typesetting with TeXShop

1. Close all open documents in TeXShop, open a new one, go the the Engine menu (immediately to the right of the “Typeset” button in the Toolbar), and select one of

ConTeXt-MKII
ConTeXt-MKIV
ConTeXt-XeTex

This will instruct TeXShop to use this engine to compose your documents.

2. Edit your ConTeXt document with TeXShop. In the TeXShop toolbar, in the “Typeset” menu, choose “ConTeXt” and “Pdftex”. (Check the TeXShop preferences for more settings.) When you want to typeset the document, simply hit Command-T press or “Typeset” at the top of the document window. This will generate a PDF file in the same folder of your .tex file.

Notes

All the process requires that you have installed on your machine rsync, ruby and perl. But if you are on MacOS X, Apple should already have provided it, so at 99% there should not be problems.