# Building from Source

Note: MathLex is distributed in a precompiled, optimized, and minified JS file. Building MathLex from source should not be necessary unless you know what you are doing and need/want to make changes.

## Requirements and Dependencies

For simplicity, this documentation assumes you are using a UNIX (including Mac OS X) or GNU/Linux environment and are familiar with basic JavaScript and CoffeeScript programming.

First, make sure you have the following applications and libraries installed:

## Building MathLex

Download the source code from the link above or clone the repository from GitHub (the % represents your prompt and should be ignored):

% git clone git://github.com/mathlex/mathlex.git

MathLex is written in CoffeeScript, and the relevant files are located in the src directory. These files are easier to read and understand than their compiled JavaScript counterparts. Type the following commands into your terminal to run the automated build script:

% cd /path/to/mathlex-source
% npm install
% make

The first command changes the terminal working directory to the location where you extracted the MathLex source code. The second command installs the following libraries and their dependencies to the node_modules directory:

The third command initiates the automated build script, which saves the compiled JS files in the build directory. In this folder, browser contains the final JS file that may be included in a web page.