Building APSIM from source

All Apsim sources are available from the github repository.

Microsoft Visual Studio (2017 or 2019) is used to build both Apsim Classic and Next Generation. The (free on registration) Community Edition will suffice.

Git: you will need at least a command line git client installed on your system, and you may feel comfortable using a GUI such as TortoiseGit to examine changes to the source tree. There are several described here.

Compiling Apsim Next Generation

Please follow the latest instructions in the nextgen online help.

Compiling ApsimClassic

1. Clone the repository:

 git clone

2. Install 7Zip, find the build library and unpack it alongside the repository.

cd ..
7z x APSIMClassic/Model/Build/BuildLibraries.7z

3. Install a 32 bit GNU fortran 7.x compiler (or any non-cygwin binary distribution). This package also includes GNU make, which is used by the builder. A zip archive is available here.

The unit tests require NUnit 2.x.

The cotton module will not build unless the password is obtained from the module owner.

To build the GUI, you will need two commercial products: TeeChart for .NET component, and  the Quantum Whale editor component.

To build the R component, you will need R installed, and the extensions RCpp, RInside.

4. Open the Visual Studio 2017/9 Developer command prompt, and change to …/APSIMClassic/Model/Build. Run the command “BuildAll.bat” in that directory.


The linux build of ApsimClassic uses the mono runtime for .NET components. Unfortunately, recent (5,6.x) versions of the runtime have proved unstable, so an older version (4.8.1) is recommended. On debian systems, this involves adding keys and repositories (as root):

gpg --keyserver hkp:// --recv-key E084DAB9
gpg -a --export E084DAB9 | apt-key add -
gpg --keyserver hkp:// --recv-key A6A19B38D3D831EF
gpg -a --export A6A19B38D3D831EF | apt-key add -

echo "deb wheezy/snapshots/4.8.1 main" > /etc/apt/sources.list.d/mono.list
echo "deb bionic-cran35/" > /etc/apt/sources.list.d/cran.list
apt-get update && apt-get -y install \
   g++ gfortran libgfortran3 \
   libxml2 libxml2-dev tcl8.5 tcllib curl \
   mono-devel mono-vbnc mono-runtime \
   r-base r-base-dev r-recommended

Rscript -e "install.packages(c(\"Rcpp\",\"RInside\"))"

Although the GUI components can be built and run under Linux, they are not fully operational, and are not supported by the APSIM development team. If you wish to experiment with the GUI, you may need to make a few changes to enable Mono on Linux to emulate the Windows registry. This can be done with the following commands:

sudo mkdir /etc/mono/registry
sudo mkdir /etc/mono/registry/ClassesRoot
sudo chmod 777 /etc/mono/registry -R