- Before installation, ensure that CMake is installed on your machine. We use brew to install Mac packages.
$ brew install cmake
- Download the gtest file from the Google Test repo and unzip it. (You can view all of the repo's releases here.)
$ curl -# -L -o "googletest-release-1.8.0.zip" "https://github.com/google/googletest/archive/release-1.8.0.zip"
$ unzip googletest-release-1.8.0.zip
- Complete the installation
$ cd googletest-release-1.8.0/googletest/
$ mkdir bld
$ cd bld
$ cmake ..
$ make
$ cp -a ../include/gtest /usr/local/include
$ cp -a *.a /usr/local/lib
- Clean up by deleting the
googletest-release-1.8.0
folder andgoogletest-release-1.8.0.zip
$ # Assuming you're still in the bld directory
$ cd ../../..
$ rm -r googletest-release-1.8.0
$ rm googletest-release-1.8.0.zip
Instructions courtesy of Zhiwei on StackOverflow.