Alloy is a language for describing structures and a tool for exploring them. It has been used in a wide range of applications from finding holes in security mechanisms to designing telephone switching networks. This repository contains the code for the tool.
Clone or download
Failed to load latest commit information.
.gradle-wrapper WIP Aug 3, 2017
cnf [build] Otherwise errors on bnd-4.0.0 (#52) May 8, 2018
org.alloytools.alloy.application Don't crash when Application.addPreferencesMenuItem() does not exist … Apr 8, 2018
org.alloytools.alloy.core Add warning on save conflicts (#62) Jul 23, 2018
org.alloytools.alloy.dist [cleanup] Applied Eclipse Cleanup rules (#39) Mar 27, 2018
org.alloytools.alloy.extra [cleanup] Applied Eclipse Cleanup rules (#39) Mar 27, 2018 [cleanup] Applied Eclipse Cleanup rules (#39) Mar 27, 2018
org.alloytools.kodkod.core [cleanup] Applied Eclipse Cleanup rules (#39) Mar 27, 2018
org.alloytools.kodkod.nativesat [cleanup] Applied Eclipse Cleanup rules (#39) Mar 27, 2018
org.alloytools.satsolver.provider/extern/minisat wip Oct 16, 2017
org.alloytools.util [cleanup] Applied Eclipse Cleanup rules (#39) Mar 27, 2018
.gitattributes WIP Aug 3, 2017
.gitignore Update .gitignore (#65) Jul 31, 2018
.travis.yml Passwords Aug 23, 2017 Create Aug 4, 2017
LICENSE Update LICENSE Aug 4, 2017 A bit more about eclipse Aug 1, 2018
build.gradle Still trying Aug 23, 2017
build.xml Fixed CompLexer, CompParser and CompSym generation (+8 squashed commi… Nov 16, 2017 WIP Aug 3, 2017
gradlew Fixed CompLexer, CompParser and CompSym generation (+8 squashed commi… Nov 16, 2017
gradlew.bat Fixed CompLexer, CompParser and CompSym generation (+8 squashed commi… Nov 16, 2017
settings.gradle Fixed CompLexer, CompParser and CompSym generation (+8 squashed commi… Nov 16, 2017

Logo Build Status


Alloy 4 is a self-contained executable, which includes the Kodkod model finder and a variety of SAT solvers, as well as the standard Alloy library and a collection of tutorial examples. The same jar file can be incorporated into other applications to use Alloy as an API, and includes the source code. See the release notes for details of new features.

More documentation can be found at:


Alloy runs on all operating systems with a recent JVM (Java 6 or later). It is made available as a runnable jar file with both a cross-platform SAT solver (Sat4j and more efficient native SAT solvers (minisat, lingeling/plingeling, glucose).

Note however that starting with macOS High Sierra, it is necessary to install a dedicated JVM to run Alloy on macOS. A .pkg file is provided for that purpose.


Checkout the project and type ./gradlew. You find the executable JAR in org.alloytools.alloy.dist/target/org.alloytools.alloy.dist.jar after the build has finished.

 $ java version           # requires 1.8 (and NOT 1.9, gradle does not run on 1.9)
 java version "1.8.0_144"
 Java(TM) SE Runtime Environment (build 1.8.0_144-b01)
 Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed model
 $ git clone
 $ cd org.alloytools.alloy
 $ ./gradlew build
 $ java -jar org.alloytools.alloy.dist/target/org.alloytools.alloy.dist.jar
 # opens GUI

Note: if you are behind a proxy, the call to gradlew is likely to fail, unless you pass it further options about the http and https proxies (and possibly your login and password on this proxy). There are several ways to pass these options, a simple one is to type (replace the XXXXX's by the adequate settings):

 $ ./gradlew -Dhttps.proxyHost=XXXXX -Dhttp.proxyHost=XXXXX -Dhttp.proxyPort=XXXXX \
      -Dhttps.proxyPort=XXXXX -Dhttp.proxyUser=XXXXX -Dhttp.proxyPassword=XXXXX \
      -Dhttps.proxyUser=XXXXX -Dhttps.proxyPassword=XXXXX \

Building Alloy

The Alloy build is using a bnd workspace setup using a maven layout. This means it can be build with Gradle and the Eclipse IDE for interactive development. Projects are setup to continuously deliver the executable.


The workspace is divided into a number of projects:

Relevant Project files

This workspace uses bnd. This means that the following have special meaning:

  • cnf/build.xml – Settings shared between projects
  • ./bnd.bnd – Settings for a project. This file will drag in code in a JAR.
  • cnf/central.xml – Dependencies from maven central


The workspace is setup for interactive development in Eclipse with the Bndtools plugin. Download Eclipse and install it. You can then Import existing projects from the Git workspace. You should be asked to install Bndtools from the market place. You can also install Bndtools directly from the Eclipse Market place (see Help/Marketplace and search for Bndtools).

Bndtools will continuously create the final executable. The projects are setup to automatically update when a downstream project changes.

IntelliJ IDEA (Ultimate Edition only)

Ensure you have the Osmorc plugin is enabled, as this plugin is needed for Bndtools support. It should be enabled by default.

  1. Choose "Import Project"
  2. Select the org.alloytools.alloy directory.
  3. Choose "Import project from external model: Bnd/Bndtools" and click "Next"
  4. For "Select Bnd/Bndtools project to import", all projects should be checked by default, click "Next"
  5. For project SDK, Choose "1.8", Click Finish

Note: do not link the Gradle project, as this will prevent you from running Alloy within IDEA.

To run the Alloy GUI within IDEA, navigate to org.alloytools.alloy.application/src/main/java/edu/mit/csail/sdg/alloy4whole/SimpleGUI and run the SimpleGUI class.


In the root of this workspace type ./gradlew. This is a script that will download the correct version of gradle and run the build scripts. For settings look at [] and [settings.gradle].

Continuous Integration

The workspace is setup to build after every commit using Travis. It releases snapshots to for every CI build on Travis.

Building the DMG file for OSX systems

Currently only the executable jar in org.alloytools.alloy.dist/target/org.alloytools.alloy.dist.jar is build. In the org.alloytools.alloy.dist project, run ../gradlew macos. This will leave the PKG file in target/bundle.


Please read the CONTRIBUTING to understand how you can contribute.