Diff for Installing OT on the Mac
Fri, 2008-05-09 19:42 by Bob Doyle | Thu, 2008-05-22 02:49 by quinn_dupont | ||
---|---|---|---|
added David's very helpful instructions from DITA Users group | |||
< previous diff | |||
Changes to Body | |||
Line 5 | Line 5 | ||
<blockquote>
| <blockquote>
| ||
<em>
| <em>
| ||
- | Before installing DITA Open Toolkit and its prerequisite software on Mac OS X, check to see if any of the tools are already installed on your system and, if so, whether the version you have is supported (see System requirements and supported applications on page 47). Java is a core component of Mac OS X. Newer versions of Mac OS X include the full version of the Java JDK 1.4.2 by default. This version of the JDK includes Ant<br />
| + | Before installing DITA Open Toolkit and its prerequisite software on Mac OS X, check to see if any of the tools are already installed on your system and, if so, whether the version you have is supported (see System requirements and supported applications on page 47). Java is a core component of Mac OS X. Newer versions (10.5) of Mac OS X include JVM 1.5 by default. This version of the JDK includes Ant<br />
|
and the Xalan-J XSLT processor, as well. Other tools you want to install may be included on the Mac OS X Developer's Tools on the product DVD.<br />
| and the Xalan-J XSLT processor, as well. Other tools you want to install may be included on the Mac OS X Developer's Tools on the product DVD.<br />
| ||
<br />
| <br />
| ||
Line 43 | Line 43 | ||
out what you need to run in Terminal, you should be able to transfer <br />
| out what you need to run in Terminal, you should be able to transfer <br />
| ||
these to either Automator or AppleScript, and add appropriate variables.
| these to either Automator or AppleScript, and add appropriate variables.
| ||
+ | </p>
| ||
+ | <p>
| ||
+ |
| ||
+ | </p>
| ||
+ | <hr />
| ||
+ | -------------
| ||
+ | <p>
| ||
+ |
| ||
+ | </p>
| ||
+ | <hr />
| ||
+ | <p>
| ||
+ |
| ||
+ | </p>
| ||
+ | <hr />
| ||
+ | <p>
| ||
+ |
| ||
+ | </p>
| ||
+ | <p>
| ||
+ | Alternate instructions from David J. B. Hollis on the Yahoo DITA user group if the above instructions do not work (and did not for me):
| ||
+ | </p>
| ||
+ | <p>
| ||
+ | Firstly check out: ant.apache.org/manual/running.html#libs<br />
| ||
+ | <br />
| ||
+ | As of Ant 1.6, Ant looks in a user directory for config files and a lib.<br />
| ||
+ | <br />
| ||
+ | I'm running Mac OS X.4, and I've installed the Developer Tools XCode 2<br />
| ||
+ | <br />
| ||
+ | Mac OS X.4 is the min. spec. for running Java 1.5.<br />
| ||
+ | <br />
| ||
+ | It's XCode 3 for OS X.5. I've not installed either, yet! (Soon,<br />
| ||
+ | hopefully...)<br />
| ||
+ | <br />
| ||
+ | Installing XCode puts a symlink from /usr/bin/ant to /Developer/Java/<br />
| ||
+ | Ant/bin/ant<br />
| ||
+ | <br />
| ||
+ | This means you can just call 'ant' from the Terminal, without<br />
| ||
+ | bothering with paths.<br />
| ||
+ | <br />
| ||
+ | If you'd rather not install XCode, then you can do something similar.<br />
| ||
+ | But first, I'd suggest running:<br />
| ||
+ | <br />
| ||
+ | ls -l -a /usr/bin<br />
| ||
+ | <br />
| ||
+ | and just check what's there!<br />
| ||
+ | <br />
| ||
+ | Assuming there's no sign of ant in /usr/bin, then enter the following<br />
| ||
+ | in Terminal:<br />
| ||
+ | <br />
| ||
+ | sudo ln -s ~/DITA-OT1.4.2.1/tools/ant/bin/ant /usr/bin/ant<br />
| ||
+ | <br />
| ||
+ | (~ is a shortcut to the User directory; sudo gives you temporary root<br />
| ||
+ | privileges, and you'll be asked for your password)<br />
| ||
+ | <br />
| ||
+ | In this and the following, edit DITA-OT1.4.2.1 to wherever you've<br />
| ||
+ | installed DITA.<br />
| ||
+ | <br />
| ||
+ | You'll probably also need to make this an executable with:<br />
| ||
+ | <br />
| ||
+ | chmod 777 ~/DITA-OT1.4.2.1/tools/ant/bin/ant<br />
| ||
+ | <br />
| ||
+ | So, you can now call ant from the Terminal!<br />
| ||
+ | <br />
| ||
+ | <br />
| ||
+ | The next stage is to configure ant.<br />
| ||
+ | <br />
| ||
+ | Ant will look for both ~/.antrc and ~/.ant/ant.conf<br />
| ||
+ | <br />
| ||
+ | Now both these files, and the .ant directory are hidden. I decided<br />
| ||
+ | I'd rather have an ant.conf file which I can see and edit easily, so<br />
| ||
+ | I used another symlink. YMMV, and you can ignore the symlink.<br />
| ||
+ | <br />
| ||
+ | Note, you can always use: open -a TextEdit /path/to/file to open a<br />
| ||
+ | file in TextEdit from Terminal.<br />
| ||
+ | <br />
| ||
+ | I created an Ant folder in Home, and saved ant.conf to it. ant.conf<br />
| ||
+ | contains the following:<br />
| ||
+ | <br />
| ||
+ | #!/bin/sh<br />
| ||
+ | <br />
| ||
+ | DITA_HOME=~/DITA-OT1.4.2.1<br />
| ||
+ | DITA_HOME=`cd "$DITA_HOME" && pwd`<br />
| ||
+ | <br />
| ||
+ | export ANT_HOME="$DITA_HOME"/tools/ant<br />
| ||
+ | #export ANT_HOME=/Developer/Java/Ant<br />
| ||
+ | export ANT_OPTS="-Xmx512m"<br />
| ||
+ | export ANT_ARGS="-lib $DITA_HOME/lib -Ddita.dir=$DITA_HOME"<br />
| ||
+ | <br />
| ||
+ | <br />
| ||
+ | OK, what does it do?<br />
| ||
+ | <br />
| ||
+ | 1. Sets up DITA_HOME, and makes sure it's a full path.<br />
| ||
+ | <br />
| ||
+ | 2. Uses DITA_HOME to define ANT_HOME<br />
| ||
+ | <br />
| ||
+ | 3. Commented out, if you have Developer Tools, uncomment this line to<br />
| ||
+ | use the XCode ant, and comment out the preceding.<br />
| ||
+ | <br />
| ||
+ | 4. Sets up ANT_OPTS with the memory requirements.<br />
| ||
+ | <br />
| ||
+ | 5. Sets up ANT_ARGS with the DITA OT lib directory, and the dita.dir<br />
| ||
+ | property.<br />
| ||
+ | <br />
| ||
+ | The -lib property can be used instead of defining CLASSPATH, with the<br />
| ||
+ | long list of jars. An absolute boon if you change jar configurations<br />
| ||
+ | at all! No need to edit CLASSPATH to match the revised configuration!<br />
| ||
+ | <br />
| ||
+ | DITA_HOME is subsequently available for use in the Terminal.<br />
| ||
+ | <br />
| ||
+ | So you can save these 7 lines in either ~/.antrc or ~/.ant/ant.conf<br />
| ||
+ | or create the symlink, to hook up ant.conf.<br />
| ||
+ | <br />
| ||
+ | For the symlink, in Terminal, make a .ant directory in Home:<br />
| ||
+ | <br />
| ||
+ | mkdir .ant<br />
| ||
+ | <br />
| ||
+ | Then add the symlink to ant.conf in the Ant folder:<br />
| ||
+ | <br />
| ||
+ | ln -s ~/Ant/ant.conf ~/.ant/ant.conf<br />
| ||
+ | <br />
| ||
+ | <br />
| ||
+ | So, that's it! To check it all works:<br />
| ||
+ | <br />
| ||
+ | ant -diagnostics<br />
| ||
+ | <br />
| ||
+ | This will tell you where ANT_HOME is, and what's on the CLASSPATH.<br />
| ||
+ | Check that dost.jar is there, and everything else!<br />
| ||
+ | <br />
| ||
+ | Now run:<br />
| ||
+ | <br />
| ||
+ | ant all -f DITA_HOME/build_demo.xml<br />
| ||
+ | <br />
| ||
+ | to run the demo build<br />
| ||
+ | <br />
| ||
+ | <br />
| ||
+ | In summary:<br />
| ||
+ | <br />
| ||
+ | 1. symlink from /usr/bin to call ant. From either Developer Tools or<br />
| ||
+ | DITA tools.<br />
| ||
+ | <br />
| ||
+ | 2. ant.conf file to set up not just ant but dita.dir as well. Place<br />
| ||
+ | this somewhere in the user directory, possibly with another symlink.<br />
| ||
+ | <br />
| ||
+ | 3. There's no need for startcmd.sh The symlinks and ant.conf are set<br />
| ||
+ | up once, and that's it!<br />
| ||
+ | <br />
| ||
+ | <br />
| ||
+ | Windows users can do something very similar. The syntaxt will be<br />
| ||
+ | different, and there's no equivalent to symlinks. But a local<br />
| ||
+ | ant.conf file is possible.<br />
| ||
</p>
| </p>
| ||
Installing OT on the Mac
The DITA Open Toolkit User Guide devotes a lot of attention to Windows
and Linux but gives Mac OS X scant attention. The brief Mac installation section on page 58 simply says
Before installing DITA Open Toolkit and its prerequisite software on Mac OS X, check to see if any of the tools are already installed on your system and, if so, whether the version you have is supported (see System requirements and supported applications on page 47). Java is a core component of Mac OS X. Newer versions (10.5) of Mac OS X include JVM 1.5 by default. This version of the JDK includes Ant
and the Xalan-J XSLT processor, as well. Other tools you want to install may be included on the Mac OS X Developer's Tools on the product DVD.
To install the Toolkit, extract the zip file to your HOME directory, then edit your login rc file to include the Toolkit in your CLASSPATH.
You must use a Terminal window to enter commands on the command line.
If you have not changed your shell, enter this (you should be logged in as an account with adminsistrator privileges):
export CLASSPATH="$HOME/DITA-OT/lib:$HOME/DITA-OT/lib/dost.jar"
The .profile file and others created are "hidden" files. It's important to remember that Mac OS X is a BSD UNIX-based OS. All filenames that have a period before them are hidden under normal circumstances. However you can view these files in the Terminal using the ls -a option.
An easier method to install the OT on Mac is the following:
The DITA-OT "Full" aka "Easy" package has a "startcmd.sh" command,
which purports to work on Mac OS X as well as on Linux. You can
source it with something like these two commands:
export DITA_HOME="$HOME/DITA-OT"
"$DITA_HOME/startcmd.sh"
You may need to grant execute permissions on this startup script:
chmod +x startcmd.sh
Other notes:
There's a Java Preferences application in the Java folder under
Utilities. You can use this to set which J2SE version to run.
Automator and AppleScript can run shell commands. Once you've figured
out what you need to run in Terminal, you should be able to transfer
these to either Automator or AppleScript, and add appropriate variables.
-------------
Alternate instructions from David J. B. Hollis on the Yahoo DITA user group if the above instructions do not work (and did not for me):
Firstly check out: ant.apache.org/manual/running.html#libs
As of Ant 1.6, Ant looks in a user directory for config files and a lib.
I'm running Mac OS X.4, and I've installed the Developer Tools XCode 2
Mac OS X.4 is the min. spec. for running Java 1.5.
It's XCode 3 for OS X.5. I've not installed either, yet! (Soon,
hopefully...)
Installing XCode puts a symlink from /usr/bin/ant to /Developer/Java/
Ant/bin/ant
This means you can just call 'ant' from the Terminal, without
bothering with paths.
If you'd rather not install XCode, then you can do something similar.
But first, I'd suggest running:
ls -l -a /usr/bin
and just check what's there!
Assuming there's no sign of ant in /usr/bin, then enter the following
in Terminal:
sudo ln -s ~/DITA-OT1.4.2.1/tools/ant/bin/ant /usr/bin/ant
(~ is a shortcut to the User directory; sudo gives you temporary root
privileges, and you'll be asked for your password)
In this and the following, edit DITA-OT1.4.2.1 to wherever you've
installed DITA.
You'll probably also need to make this an executable with:
chmod 777 ~/DITA-OT1.4.2.1/tools/ant/bin/ant
So, you can now call ant from the Terminal!
The next stage is to configure ant.
Ant will look for both ~/.antrc and ~/.ant/ant.conf
Now both these files, and the .ant directory are hidden. I decided
I'd rather have an ant.conf file which I can see and edit easily, so
I used another symlink. YMMV, and you can ignore the symlink.
Note, you can always use: open -a TextEdit /path/to/file to open a
file in TextEdit from Terminal.
I created an Ant folder in Home, and saved ant.conf to it. ant.conf
contains the following:
#!/bin/sh
DITA_HOME=~/DITA-OT1.4.2.1
DITA_HOME=`cd "$DITA_HOME" && pwd`
export ANT_HOME="$DITA_HOME"/tools/ant
#export ANT_HOME=/Developer/Java/Ant
export ANT_OPTS="-Xmx512m"
export ANT_ARGS="-lib $DITA_HOME/lib -Ddita.dir=$DITA_HOME"
OK, what does it do?
1. Sets up DITA_HOME, and makes sure it's a full path.
2. Uses DITA_HOME to define ANT_HOME
3. Commented out, if you have Developer Tools, uncomment this line to
use the XCode ant, and comment out the preceding.
4. Sets up ANT_OPTS with the memory requirements.
5. Sets up ANT_ARGS with the DITA OT lib directory, and the dita.dir
property.
The -lib property can be used instead of defining CLASSPATH, with the
long list of jars. An absolute boon if you change jar configurations
at all! No need to edit CLASSPATH to match the revised configuration!
DITA_HOME is subsequently available for use in the Terminal.
So you can save these 7 lines in either ~/.antrc or ~/.ant/ant.conf
or create the symlink, to hook up ant.conf.
For the symlink, in Terminal, make a .ant directory in Home:
mkdir .ant
Then add the symlink to ant.conf in the Ant folder:
ln -s ~/Ant/ant.conf ~/.ant/ant.conf
So, that's it! To check it all works:
ant -diagnostics
This will tell you where ANT_HOME is, and what's on the CLASSPATH.
Check that dost.jar is there, and everything else!
Now run:
ant all -f DITA_HOME/build_demo.xml
to run the demo build
In summary:
1. symlink from /usr/bin to call ant. From either Developer Tools or
DITA tools.
2. ant.conf file to set up not just ant but dita.dir as well. Place
this somewhere in the user directory, possibly with another symlink.
3. There's no need for startcmd.sh The symlinks and ant.conf are set
up once, and that's it!
Windows users can do something very similar. The syntaxt will be
different, and there's no equivalent to symlinks. But a local
ant.conf file is possible.