- Installing from Source Code
- Developer Versions
- Installing with the CPAN Module
- Platform-Specific Binaries
- Mac OSX
- Debian GNU/Linux
- Microsoft Windows
- Github Source Code Repository
- HTML Documentation
- Related Modules
- Editor Bundles
- Sublime Text 2
- Kate: KDE Advanced Text Editor
The Template Toolkit is free in both senses of the word: free beer and free speech. It is free in the first sense because it costs absolutely nothing to download and use the Template Toolkit. And it's free in the second sense because it's distributed under an Open Source license. That mean that you get the full source code to the Template Toolkit and you're explicitly granted the right to modify and adapt the code, should you so wish.
You'll need to have Perl version 5.6.0 or later installed on your machine. Perl comes pre-installed on all modern Unix-based systems (which includes Mac OSX). It's freely available for virtually every modern operating system under the sun, so you have no excuse for not installing it if you don't already have it. Don't be scared now. You don't have to write any Perl code to use the Template Toolkit.
Stable versions of the Template Toolkit source code can be downloaded from CPAN. The latest stable version of the Template Toolkit is 2.25.Download Template Toolkit stable version 2.25
The source code is distributed as a
You'll need to unpack it and follow the instructions in the
For those impatient types who don't have time to read the documentation, it goes like this:
$ tar zxf Template-Toolkit-2.25.tar.gz $ cd Template-Toolkit-2.25 $ perl Makefile.PL $ make $ make test $ sudo make install
In addition to the stable releases available from CPAN, we also release interim developer versions from time to time. These contain additional features, bug fixes and other updates over the latest stable version.
Developer versions have an additional numerical suffix (e.g. 2.25_01, 2.25_02, etc) and are available to download from this web site. You can also download them from CPAN. Note however that the CPAN module won't install developer releases by default.
There are no developer versions released at present.
If you have the CPAN module installed then you can install the Template Toolkit like so:
$ sudo cpan Template
The above assumes a Unix-like system (which includes Mac OSX) and uses
sudo to run the
cpan Template command with administrator privileges.
The CPAN module is distributed with more recent versions of Perl (5.8 and later) so there's a good chance you've already got the CPAN module installed if your version of Perl is up-to-date.
You can also get the Template Toolkit in "binary form" for installation on various platforms. Don't be misled by the name - you still get the full source code for the Template Toolkit, but it's delivered in a packaged format that you can install straight onto your system without having to build it from source.
If you're running Mac OSX (you lucky thing!) then you can install the
Template Toolkit using the CPAN module as
described above. Run the Terminal application (located in
Applications/Utilities) and enter the
sudo cpan Template
command at the prompt.
Alternately, if you have
installed then you can use it to install the Template Toolkit.
Christian Schaffner maintains the Fink packages for the Template
Toolkit. They can be found in the
Mako Hill maintains the official Template Toolkit packages for
GNU/Linux. They are available in Debian as
Debian package pages for the latest versions can be found at:
You can download the packages and the source for the latest TT2 packages at:http://people.debian.org/~mako/outgoing/libtemplate-perl/
If you use
want to use the latest Template Toolkit packages, then
simply add the following line to your
deb http://people.debian.org/~mako/outgoing/ ./
Of course, you can also install the Template Toolkit on any Unix-like system using the CPAN module, as described above.
If you're using a Microsoft Windows machine then you have our sympathies. However, if you're using Strawberry Perl then you can install TT using the CPAN module as described above. If you're using ActivePerl and then use the Perl Package Manager (PPM) to install the Template Toolkit.
Our friends over at Bugzilla have put a page together telling you where you can find the relevant PPM files.Links to ActivePerl PPM packages
The source code for the Template Toolkit is managed using Git and is hosted at Github If you have git installed on your system then you can check out the Template Toolkit source code using a command like this:
$ git clone git://github.com/abw/Template2.git
You can browse the repository here:http://github.com/abw/Template2
You can download a copy of the complete HTML documentation for the Template Toolkit. It comes in the same shiny colours as this web site for your viewing pleasure.
In times gone by, the Template Toolkit was distributed with a whole bunch of plugin modules for doing all sorts of things. These included: querying databases via the DBI module, processing XML documents, typesetting output using LaTeX, and generating images using the GD library.
In a fit of common sense, they were eventually removed from the core Template Toolkit distribution and made available as separate bundles. You can download them from CPAN using the following links or you can install them using the CPAN module as described above.Template-DBI Template-GD Template-XML Template-Latex
These modules have corresponding projects in the old Subversion repository. You can check out the source code for any of the above projects like so:
$ svn co svn://svn.tt2.org/tt/Template-DBI/trunk Template-DBI
TextMateA TT bundle for TextMate is available. This is version 0.02 which has full support for TT2. including syntax highlighting and a number of auto-completion snippets for generating TT code fragments. It also has limited support for the forthcoming TT3 template language. Language definitions are provided for TT2/TT3 in stand-alone files, or embedded in HTML (HTML + TT2, HTML + TT3). Textmate-TT-0.02.tar.gz Textmate-TT-0.02.zip
Sublime Text 2The Sublime Text 2 editor uses the same bundle format as TextMate so you can use the TextMate bundles above. Simply unpack the download archive and drag the
Template Toolkit.tmbundlefolder to
~/Library/Application Support/Sublime Text 2/Packages.