Installation Notes for macOS

To install GAMS, please follow the steps below as closely as possible. We advise you to read this entire document before beginning the installation procedure. Furthermore, we recommend to use the PKG installer for macOS because it includes the GAMS Studio and it integrates GAMS into macOS, e.g. it is possible to open the GAMS Studio via the Launchpad.

Two installation procedures are available for GAMS on macOS:

Installation using the PKG installer (GAMS48.3.0.pkg)

  1. Obtain the GAMS PKG file for your CPU architecture (x86_64 or arm64), which is available from http://www.gams.com/download.
  2. Double click the package and follow the instructions. By clicking on Customise in the tab Installation Type you can decide to add GAMS to the PATH as well as to reject the installation of GAMS Studio. Note that adding GAMS to the PATH is done by modifying your shell profile file (~/.zprofile, ~/.bash_profile etc.). A backup of your old profile is saved (~/.zprofile.gamsbackup, ~/.bash_profile.gamsbackup etc.).
  3. In order to test the GAMS installation with GAMS Studio open the Launchpad and click the GAMS Studio 48 icon to open the application. Alternatively, go to Applications and open the GAMS Studio 48 application.
  4. Install a valid GAMS license. More on the license setup can be found here.
  5. Open the Model Library Explorer and open the TRNSPORT model (sequence number 001). Run the model and check the contents of the process log, which should be similar to the Terminal output listed in the next bullet point.
  6. In order to test the GAMS installation without using GAMS Studio open a Terminal window. Execute the following commands to see if everything works as expected:

    gamslib trnsport
    gams trnsport
    

    The output should be similar to this:

    --- Job trnsport Start 06/26/14 11:24:56 24.3.1 r46409 DEX-DEG Mac x86_64/Darwin
    GAMS 24.3.1   Copyright (C) 1987-2014 GAMS Development. All rights reserved
    Licensee: ...
    --- Starting compilation
    --- trnsport.gms(69) 3 Mb
    --- Starting execution: elapsed 0:00:00.024
    --- trnsport.gms(45) 4 Mb
    --- Generating LP model transport
    --- trnsport.gms(66) 4 Mb
    ---   6 rows  7 columns  19 non-zeroes
    --- Executing CPLEX: elapsed 0:00:00.114
    
    IBM ILOG CPLEX   24.3.1 ... DEG Mac x86_64/Darwin
    Cplex 12.6.0.0
    
    Reading data...
    Starting Cplex...
    Space for names approximately 0.00 Mb
    Use option 'names no' to turn use of names off
    Tried aggregator 1 time.
    LP Presolve eliminated 1 rows and 1 columns.
    Reduced LP has 5 rows, 6 columns, and 12 nonzeros.
    Presolve time = 0.02 sec. (0.00 ticks)
    
    Iteration      Dual Objective            In Variable           Out Variable
         1              73.125000    x(seattle.new-york) demand(new-york) slack
         2             119.025000     x(seattle.chicago)  demand(chicago) slack
         3             153.675000    x(san-diego.topeka)   demand(topeka) slack
         4             153.675000  x(san-diego.new-york)  supply(seattle) slack
    LP status(1): optimal
    Cplex Time: 0.03sec (det. 0.01 ticks)
    
    Optimal solution found.
    Objective :         153.675000
    
    --- Restarting execution
    --- trnsport.gms(66) 2 Mb
    --- Reading solution for model transport
    --- trnsport.gms(68) 3 Mb
    *** Status: Normal completion
    --- Job trnsport.gms Stop 06/26/14 11:24:57 elapsed 0:00:00.487
    

Uninstall PKG installation

To uninstall a GAMS installation that was installed using the PKG installer, run the following command from the terminal: sudo bash /Library/Frameworks/GAMS.framework/Versions/48/Resources/uninstall.sh. Additionally, you can remove GAMS from the PATH in your shell profile file (~/.zprofile, ~/.bash_profile) if GAMS was added to the PATH during installation.

Installation using the self-extracting archive (osx_x64_64_sfx.exe or osx_arm64_sfx.exe)

The following instructions are for the macOS system on Intel/AMD CPUs (x86_64). For a macOS system on ARM64 CPUs, the same instructions apply, but with x64_64 replaced by arm64 in all file names.

  1. Obtain the GAMS distribution file, which is available from http://www.gams.com/download, in one large self-extracting zip archive with a _sfx.exe file extension, e.g., osx_x64_64_sfx.exe. Check that it has the execute permission set. If you are not sure how to do this, just type in the command chmod 755 osx_x64_64_sfx.exe .
    Attention
    The common way to install GAMS on a Mac is the PKG installer. When one tries to run the sfx installer (e.g. for unattended installation) under macOS 10.15 (Catalina) or newer, the installer and several related files will be tagged with the com.apple.quarantine flag. There are different solutions to this problem:
    • The flag can be removed by the following command:
      xattr -rd com.apple.quarantine osx_x64_64_sfx.exe
      
    • Instead of downloading the sfx installer through the browser, use a command line tool such as curl (note that by downloading the software, you agree to the License Agreement). The download link may need to be adjusted, depending on the distribution that should be downloaded.
      curl https://d37drm4t2jghv5.cloudfront.net/distributions/29.1.0/macosx/osx_x64_64_sfx.exe -o osx_x64_64_sfx.exe
      
  2. Choose a location where you want to create the GAMS system directory (the GAMS system directory is the directory where the GAMS system files should reside). At this location the GAMS installer will create a subdirectory with a name that indicates the distribution of GAMS you are installing. For example, if you are installing the 24.3 distribution in /Applications/GAMS, the installer will create the GAMS system directory /Applications/GAMS/gams24.3_osx_x64_64_sfx. If the directory where you want to install GAMS is not below your home directory, you may need to have root privileges on the machine.
  3. Create the directory that should contain the GAMS system directory, for instance /Applications/GAMS. Change to this directory (cd /Applications/GAMS). Make sure pwd returns the name of this directory correctly.
  4. Run the distribution file, either from its current location or after transfering it to the directory that should contain the GAMS system directory. By executing the distribution file, the GAMS distribution should be extracted. For example, if you downloaded the distribution file into your home directory, you might execute the following commands:
    mkdir /Applications/GAMS
    cd    /Applications/GAMS
    ~/osx_x64_64_sfx.exe
    
  5. Install a valid GAMS license. More on the license setup can be found here.

    Attention
    Do not store the gamslice.txt in the GAMS system directory. This invalidates the code signature and cause Gatekeeper to reject the bundle!

    GAMS searches a couple of system wide and user specific locations for a license file. For macOS these locations include /Library/Application Support/GAMS and /Users/username/Library/Application Support/GAMS. The locations can vary due to different system configuration. One can get an ordered list of data directories GAMS searches for gamslice.txt by running the program ./gamsinst -listdirs from the GAMS system directory. Even though this list might contain locations in the system directory, e.g. /Applications/GAMS31.1 we strongly discourage to place gamslice.txt here.

  6. Change to the GAMS system directory and run the program ./gamsinst. It will prompt you for default solvers to be used for each class of models. If possible, choose solvers you have licensed since unlicensed solvers will only run in demonstration mode. These solver defaults can be changed or overridden by:

    a. rerunning ./gamsinst and resetting the default values

    b. setting a command line default, e.g., gams trnsport lp=soplex

    c. an option statement in the GAMS model, e.g: option lp=soplex;

  7. Add the GAMS system directory to your path (see below).
  8. To test the installation, log in as a normal user and run a few models from your home directory, but not the GAMS system directory:
    LP:    trnsport (objective value:  153.675)
    NLP:   chenery  (objective value:  1058.9)
    MIP:   bid      (optimal solution: 15210109.512)
    MINLP: procsel  (optimal solution: 1.9231)
    MCP:   scarfmcp (no objective function)
    MPSGE: scarfmge (no objective function)
    
  9. If you move the GAMS system to another directory, remember to rerun ./gamsinst. It is also good practice to rerun ./gamsinst when you change your license file if this has changed the set of licensed solvers.

Access to GAMS

To run GAMS you must be able to execute the GAMS programs located in the GAMS system directory. There are several ways to do this. Remember that the GAMS system directory in the examples below may not correspond to the directory where you have installed your GAMS system.

  1. If you are using the C shell (csh) and its variants you can modify your .cshrc file by adding the second of the two lines given below:
    set path = (/your/previous/path/setting )
    set path = ( $path /Applications/GAMS/gams24.3_osx_x64_64_sfx ) # new
    
  2. Those of you using the Bourne (sh) or Korn (ksh) shells and their variants can modify their .profile file by adding the second of the three lines below:
    PATH=/your/previous/path/setting
    PATH=$PATH:/Applications/GAMS/gams24.3_osx_x64_64_sfx  # new
    export PATH
    
    If the .profile file does not exist yet, it needs to be created. You should log out and log in again after you have made any changes to your path.
  3. You may prefer to use an alias for the names of the programs instead of modifying the path as described above. C shell users can use the following commands on the command line or in their .cshrc file:
    alias gams /Applications/GAMS/gams24.3_osx_x64_64_sfx/gams
    alias gamslib /Applications/GAMS/gams24.3_osx_x64_64_sfx/gamslib
    
    The correct Bourne or Korn shell syntax (either command line or .profile) is:
    alias gams=/Applications/GAMS/gams24.3_osx_x64_64_sfx/gams
    alias gamslib=/Applications/GAMS/gams24.3_osx_x64_64_sfx/gamslib
    
    Again, you should log out and log in in order to put the alias settings in .cshrc or .profile into effect.
  4. Casual users can always type the absolute path names of the GAMS programs, e.g.:
    /Applications/GAMS/gams24.3_osx_x64_64_sfx/gams trnsport
    

Example

The following shows the log of a session, where a user downloads a GAMS 24.3.1 system and installs it under Applications/GAMS/gams24.3_osx_x64_64_sfx. It is assumed that a GAMS license file has been stored as /Users/doe/gamslice.txt.

doe@mac:/Users/doe$ curl -L -k -O \
  http://d37drm4t2jghv5.cloudfront.net/distributions/24.3.1/macosx/osx_x64_64_sfx.exe
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  148M  100  148M    0     0  4374k      0  0:00:34  0:00:34 --:--:-- 5906k
doe@mac:/Users/doe$ chmod 755 osx_x64_64_sfx.exe
doe@mac:/Users/doe$cd /Applications/GAMS
doe@mac:/Applications/GAMS$ ~/osx_x64_64_sfx.exe
UnZipSFX 5.52 of 28 February 2005, by Info-ZIP (http://www.info-zip.org).
   creating: gams24.3_osx_x64_64_sfx/
  inflating: gams24.3_osx_x64_64_sfx/sp2full.m
  inflating: gams24.3_osx_x64_64_sfx/optpathnlp.def
  inflating: gams24.3_osx_x64_64_sfx/MessageReceiverWindow.exe
  inflating: gams24.3_osx_x64_64_sfx/datalib
  inflating: gams24.3_osx_x64_64_sfx/empsyntax.txt
  inflating: gams24.3_osx_x64_64_sfx/optlindoglobal.html
...
  inflating: gams24.3_osx_x64_64_sfx/apifiles/CSharp/DomainChecking/DomainChecking.cs
  inflating: gams24.3_osx_x64_64_sfx/apifiles/CSharp/DomainChecking/DomainChecking.csproj
  inflating: gams24.3_osx_x64_64_sfx/apifiles/CSharp/xp_example2.cs
  inflating: gams24.3_osx_x64_64_sfx/optdicopt.html

doe@mac:/Applications/GAMS$cd gams24.3_osx_x64_64_sfx
doe@mac:/Applications/GAMS/gams24.3_osx_x64_64_sfx$./gamsinst -license ~/gamslice.txt

-----------------------------------------------------
gamsinst run on Wed Jun 25 19:25:29 2014
GAMS sysdir is "/Applications/GAMS/gams24.3_osx_x64_64_sfx"

LP (Linear Programming) models can be solved by:
   1.           CBC  (demo or student license)
   2.        CONOPT  (demo or student license)
   3.         CPLEX  (demo or student license)
   4.        GUROBI  (demo or student license)
   5.         IPOPT  (demo or student license)
   6.        IPOPTH  (demo or student license)

...

Installed defaults:

         LP: CPLEX
        MIP: CPLEX
       RMIP: CPLEX
        NLP: CONOPT
        MCP: PATH
       MPEC: NLPEC
      RMPEC: NLPEC
        CNS: CONOPT
       DNLP: CONOPT
     RMINLP: CONOPT
      MINLP: DICOPT
        QCP: CONOPT
      MIQCP: SBB
     RMIQCP: CONOPT
        EMP: JAMS

We are now prepared to set read and execute permissions on the
GAMS system files.  If you are not sure which option to choose,
we recommend option 3.
You can set read (and execute) permission for:
 1. user only.
 2. user and group.
 3. user, group, and world.
 Enter your choice now
3
The files "gams", "gamslib", etc., are now executable.
You can run these commands in a number of ways:
  1. Call them using an absolute path (i.e. /Applications/GAMS/gams24.3_osx_x64_64_sfx/gams).
  2. Create your own aliases for them.
  3. Add the GAMS system directory "/Applications/GAMS/gams24.3_osx_x64_64_sfx" to your path.
Method 3. is recommended.
doe@mac:/Applications/GAMS/gams24.3_osx_x64_64_sfx$cd
doe@mac:/Users/doe$/Applications/GAMS/gams24.3_osx_x64_64_sfx/gamslib trnsport
 Copy ASCII: trnsport.gms
doe@mac:/Users/doe$/Applications/GAMS/gams24.3_osx_x64_64_sfx/gams trnsport.gms  license ~/gamslice.txt
--- Job trnsport Start 06/26/14 11:24:56 24.3.1 r46409 DEX-DEG Mac x86_64/Darwin
GAMS 24.3.1   Copyright (C) 1987-2014 GAMS Development. All rights reserved
Licensee: ...
--- Starting compilation
--- trnsport.gms(69) 3 Mb
--- Starting execution: elapsed 0:00:00.024
--- trnsport.gms(45) 4 Mb
--- Generating LP model transport
--- trnsport.gms(66) 4 Mb
---   6 rows  7 columns  19 non-zeroes
--- Executing CPLEX: elapsed 0:00:00.114

IBM ILOG CPLEX   24.3.1 ... DEG Mac x86_64/Darwin
Cplex 12.6.0.0

Reading data...
Starting Cplex...
Space for names approximately 0.00 Mb
Use option 'names no' to turn use of names off
Tried aggregator 1 time.
LP Presolve eliminated 1 rows and 1 columns.
Reduced LP has 5 rows, 6 columns, and 12 nonzeros.
Presolve time = 0.02 sec. (0.00 ticks)

Iteration      Dual Objective            In Variable           Out Variable
     1              73.125000    x(seattle.new-york) demand(new-york) slack
     2             119.025000     x(seattle.chicago)  demand(chicago) slack
     3             153.675000    x(san-diego.topeka)   demand(topeka) slack
     4             153.675000  x(san-diego.new-york)  supply(seattle) slack
LP status(1): optimal
Cplex Time: 0.03sec (det. 0.01 ticks)

Optimal solution found.
Objective :         153.675000

--- Restarting execution
--- trnsport.gms(66) 2 Mb
--- Reading solution for model transport
--- trnsport.gms(68) 3 Mb
*** Status: Normal completion
--- Job trnsport.gms Stop 06/26/14 11:24:57 elapsed 0:00:00.487