Where to store your license key file

When you run the Gurobi Optimizer, it will look for the gurobi.lic key file in three different default locations. It will always look in your home directory. In addition, on a Windows system, Gurobi Optimizer 5.6.0 will also look in c:\gurobi and c:\gurobi560. On a Linux system, it will also look in /opt/gurobi and /opt/gurobi560. On a Mac system, it will also look in /Library/gurobi and /Library/gurobi560. Note that these default paths are absolute, so for example Gurobi will look for the license key file in c:\gurobi, even if the software is installed in d:\gurobi560.

The grbgetkey program will suggest a location in which to store your license key file, but it also allows you to choose an alternate location. If you accept its suggestion, there is nothing else to do. Otherwise, please read on.

While we allow you to store your license key file in a non-default location, we'd like to strongly recommend that you use the default location, particularly if you are settting up a token server or a compute server. Setting up a non-default location is quite error-prone and a frequent source of trouble.

If you would still like to use a non-default license key file location, you can do so by setting environment variable GRB_LICENSE_FILE to point to the license key file. Important note: the environment variable should point to the license key file itself, not to the directory that contains the file.

Setting an environment variable - Windows

On Windows systems, environment variables are created and modified through the Control Panel. Searching for Environment Variables from the Control Panel search box will lead you to the appropriate screen. You will need to add a new System variable named GRB_LICENSE_FILE, and set it to the location of your license file (e.g., d:\gurobi\gurobi.lic). Important note: your new environment variable must be a System variable, not a User variable.

Setting an environment variable - Linux

On Linux systems, if you choose to put the license key file in a non-default location, you should add a line like the following to your .bashrc file:

  export GRB_LICENSE_FILE=/usr/home/jones/gurobi.lic
For Linux csh shell users, you should add the following to your .cshrc file:
  setenv GRB_LICENSE_FILE /usr/home/jones/gurobi.lic
You should of course set the variable to point to the actual location of your license key file.

Setting an environment variable - Mac

On Mac systems, you can set the optional GRB_LICENSE_FILE environment variable through environment.plist, as explained in Apple's Runtime configuration Guidelines.

Try Gurobi for Free

Choose the evaluation license that fits you best, and start working with our Expert Team for technical guidance and support.

Evaluation License
Get a free, full-featured license of the Gurobi Optimizer to experience the performance, support, benchmarking and tuning services we provide as part of our product offering.
Academic License
Gurobi supports the teaching and use of optimization within academic institutions. We offer free, full-featured copies of Gurobi for use in class, and for research.
Cloud Trial

Request free trial hours, so you can see how quickly and easily a model can be solved on the cloud.

Search