Repository for Ideas & Research
Open Source GIS, Hydrologic Modeling, Optimization

How to compile GRASS GIS on MS-Windows

There is a great wiki page that explains step-by-step procedures on how to compile GRASS GIS on MS-Windows, but it requires the installation of Visual Studio and installs compiled GRASS GIS into the OSGeo4W directory structure. Since I just wanted to compile and run it from the trunk repository, I needed to slightly modify the steps in the wiki page.

1   Install OSGeo4W

  1. Download and run the OSGeo4W installer (32-bit or 64-bit)
  2. Advanced Install, Next
  3. Install from Internet, Next
  4. C:\OSGeo4W (32-bit) or C:\OSGeo4W64 (64-bit), Next
  5. Next
  6. Direct Connection, Next
  7. Select a download site, Next
  8. Install the following packages:
    • cairo
    • gdal
    • gdal-ecw
    • gdal-mrsid
    • geos
    • fftw
    • fftw-devel (32-bit only)
    • freetype-devel
    • freetype-devel-mingw (32-bit only)
    • iconv
    • libjpeg
    • liblas-devel
    • libpng
    • libpq
    • libtiff
    • libxdr
    • pdcurses
    • proj
    • python-numpy
    • python-six
    • regex-devel
    • sqlite3
    • wxpython
    • zlib
    • zstd
    • zstd-devel

2   Install MSYS2

  1. Download and run the MSYS2 installer (as of July 21, 2018, 32-bit or 64-bit)
  2. Next
  3. C:\msys32 (32-bit) or C:\msys64 (64-bit), Next
  4. Next
  5. Uncheck Run MSYS2 32bit now (32-bit) or Run MSYS2 64bit now (64-bit), Finish
  6. Run MSYS2 MinGW 32-bit (32-bit) or MSYS2 MinGW 64-bit (64-bit)
  7. Install the following packages (both 32-bit and 64-bit)
    pacman -S tar libintl make bison diffutils subversion dos2unix zip
  8. Install these packages
    • 32-bit:
      pacman -S mingw-w64-i686-toolchain mingw-w64-i686-cairo mingw-w64-i686-python2-numpy mingw-w64-i686-sqlite3 mingw-w64-i686-xz mingw-w64-i686-lz4
    • 64-bit:
      pacman -S mingw-w64-x86_64-toolchain mingw-w64-x86_64-cairo mingw-w64-x86_64-python2-numpy mingw-w64-x86_64-sqlite3 mingw-w64-x86_64-xz mingw-w64-x86_64-lz4

3   Compile GRASS GIS

  1. Add two export lines to ~/.bash_profile by running
    • 32-bit:
      cat <<EOT >> ~/.bash_profile
      export LC_ALL=C
      export PATH="$PATH:/c/osgeo4w/bin"
    • 64-bit:
      cat <<EOT >> ~/.bash_profile
      export LC_ALL=C
      export PATH="$PATH:/c/osgeo4w64/bin"
  2. Source ~/.bash_profile
    . ~/.bash_profile
  3. Checkout the GRASS GIS trunk repository
    mkdir -p ~/usr/grass
    cd ~/usr/grass
    svn checkout
  4. Download,, and in ~/usr/grass
  5. Configure and compile GRASS GIS
    cd ~/usr/grass/trunk
  6. Create batch files for MS-Windows in ~/usr/grass/bin
  7. Create a shortcut to C:\msys64\home\USERNAME\usr\grass\bin\grass77svn.bat and change the icon to C:\msys64\home\USERNAME\usr\grass\trunk\mswindows\grass.icon


Please leave this field blank: