Search
Close this search box.
Group 19 Copy 2

AMPL Guides

How to Install AMPL

Welcome to the AMPL Installation Guide. Here, you will find detailed instructions on how to install AMPL and its solvers on different operating systems. Follow the steps below to get started with your AMPL journey.

AMPL Guide - How to Install AMPL

Introduction

AMPL (A Mathematical Programming Language) is a comprehensive and powerful tool for large-scale optimization and mathematical programming problems. Whether you’re a student, a researcher, or a professional, AMPL offers a range of features to facilitate your work in optimization.

After downloading your AMPL & Solvers bundle from the AMPL Portal, please follow the instructions below that correspond to your operating system.

Windows Installation

Using the Installer

We recommend using the provided installer for Windows, which simplifies the installation process.

Manual Installation

For those who prefer the old manual procedure, follow these steps:

  1. Download and Extract:
    • Download and extract your bundle. This will be your AMPL folder. Rename it if you like and move it to any convenient location on your computer.

Warning:

Ensure you place ampl.mswin64 in a folder where you have write permissions without Administrator access.

2. Running AMPL:

    • Via IDE:
      • In your AMPL folder, enter the amplide folder and double-click amplide.exe to start the IDE.
    • Via Command Line:
      • Inside your AMPL folder, double-click the sw.exe icon and type ampl at the prompt in the window that appears. Then you will see an ampl: prompt and can proceed to type AMPL commands.

3. Activate Your License:

    • If you received a license UUID (e.g., AMPL CE licenses), run this command in AMPL to activate your license:
ampl
C
ampl: shell "amplkey activate --uuid <license-uuid>";
# replace <license-uuid> by the license UUID

*Note: You need to restart AMPL to start using the new license.

Linux Installation

  1. Download and Extract:
    • Download and extract your bundle above. This will be your AMPL directory. Rename it if you like, and move it anywhere on your computer that you want.

Warning:

Please make sure you place AMPL in a directory where you have write permissions such as your home directory. Otherwise, please see the note at the end.

2. Running AMPL:

    • Via IDE:
      • Inside your AMPL folder, enter the directory named amplide and run the amplide executable.
    • Via Command Line:
      • In a command window, use cd to go to your AMPL directory, then type ./ampl at the system prompt. Then you will see an ampl: prompt and can proceed to type AMPL commands.

3. Activate your license if you received a license UUID (e.g., AMPL CE licenses):

    • Run this command in AMPL to activate your license:
ampl
C
ampl: shell "amplkey activate --uuid <license-uuid>";
      # replace <license-uuid> by the license UUID

*Note: you need to restart AMPL in order to start using the new license.

Note:

If you install AMPL somewhere in your home directory, you do not need to worry about the following.

If you use cloud licenses (e.g., AMPL Community Edition licenses), the AMPL directory cannot be read-only. If really you want to have AMPL installed on a read-only directory, you need to set the environment variables AMPL_LICFILE to a location where you store ampl.lic and where you have permissions to write, and set AMPLKEY_RUNTIME_DIR to a temporary directory.

For instance, assuming that you want to install AMPL on a Linux system in the /opt directory, which is not writeable by normal users. To install AMPL and dynamic licenses, you need to do the following:

1. Unpack the AMPL tarball into /opt as root user. The executables should then be at /opt/ampl.linux-intel64/.

2. For each user that wants to use this AMPL installation with his own license:

a. Define environment variables to point to a writeable directory in the user home directory:

ampl
C
    export AMPL_LICFILE=$HOME/.ampl/ampl.lic
    export AMPLKEY_RUNTIME_DIR=$HOME/.ampl
    export PATH=/opt/ampl.linux-intel64/:$PATH

and add those definitions to the .bash_profile or .bashrc of each user.

b. Start a new terminal in order to load the new environment variable definitions.

c. Run the amplkey activate --uuid <license-uuid> command in the terminal.

macOS Installation

Using the Installer

We recommend using the provided installer for macOS, which simplifies the installation process, instead of following the old manual procedure with tgz packages.

Manual Installation

For those who prefer the old manual procedure, follow these steps:

1. Download and Extract:

    • Download and extract your bundle. This will be your AMPL folder. Rename it if you like and move it to any convenient location on your computer.

2. Next, you will need to tell macOS that your AMPL software is safe to run. Double-click your AMPL folder to open it and then follow these steps:

    • Control-click the ampl.command file and select ‘Open’ in the context menu.
      • If a warning message (“macOS cannot verify the developer…”) pops up, click ‘Open’.

      • A Terminal window will appear. After a few seconds, you will see ampl: in the last line in the window. You can now close the window. (If a warning message saying “Do you want to terminate running processes in this window?” pops up, click ‘Terminate’.)

Warning:

If this step is skipped, you will get errors such as: “Amplide” is damaged and can’t be opened. You need to run ampl.command to tell macOS that your AMPL software is safe to run.

3. Running AMPL:

    • Via IDE:
      • In your AMPL folder, enter the amplide folder and then double-click the Amplide application (with a black cat’s-head icon) to start the IDE. (The first time you open the AMPL IDE, you might see a few “Amplide would like to access files” boxes at startup; click OK in each box to dismiss it.)
    • Via Command Line:
      • In your AMPL folder, double-click ampl. You should see an ampl: prompt appear and can now proceed to enter AMPL commands.

3. Activate your license if you received a license UUID (e.g., AMPL CE licenses):

    • Run this command in AMPL to activate your license:
ampl
C
ampl: shell "amplkey activate --uuid <license-uuid>";
      # replace <license-uuid> by the license UUID

*Note: you need to restart AMPL in order to start using the new license.

Note:

If you install AMPL somewhere in your home directory, you do not need to worry about the following.

If you use cloud licenses (e.g., AMPL Community Edition licenses), the AMPL directory cannot be read-only. If really you want to have AMPL installed on a read-only directory, you need to set the environment variables AMPL_LICFILE to a location where you store ampl.lic and where you have permissions to write, and set AMPLKEY_RUNTIME_DIR to a temporary directory.

Table of Contents

Need support?

Our team is here to make sure you install and use AMPL to its full potential. 

More Resources

AMPL offers a wealth of resources to help modelers and developers get the most out of the language.