blob: ab51cdb7fb43b7ae4bc40f6f17b8fd20f737eed7 [file] [log] [blame]
layout: default
title: Building gdal-java on Mac OS X
# Building gdal on Mac OS X
The following procedure has been adapted form the [GDAL CI](
set -e
xcode-select --installs
brew install cmake
brew install proj
brew install boost
brew install swig
brew install sqlite
brew install thrift
brew install --cask miniconda
git clone
git checkout v3.6.4
conda update -n base -c defaults conda
conda install -y compilers automake pkgconfig cmake
conda config --set channel_priority strict
conda install --yes --quiet proj=7.1.1=h45baca5_3 python=3.8 swig -y
conda install --yes --quiet libgdal=3.1.4=hd7bf8dc_0 --only-deps -y
find ${CONDA_PREFIX}/lib -name '*.la' -delete
mkdir build
cd build
CFLAGS="-Wextra -Werror -Wunused-variable" CXXFLAGS="-Wextra -Werror -Wunused-variable" cmake .. \
make -j3
make install
After this, the library can be found in `~/install-gdal/share/java/libgdalalljni.dylib`.
When starting a java application, the library can be loaded with the following command:
java -Djava.library.path=~/install-gdal/share/java -jar myapp.jar