diff --git a/.travis.yml b/.travis.yml
index 6a06339ff697a16317bef47e3a8f197a07937035..aef80d6972b6e18675e09af49fc1c55ae71857fd 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,23 +1,47 @@
 language: cpp
-env:
+matrix:
+  include:
 # list of configurations to be attempted:
 # MPI + doc
 # this is the "master" one, it is going to update the manual if log contains [makedoc]
-  - PLUMED_CC=mpicc PLUMED_CXX=mpic++ MAKEDOC=yes ALMOST=yes
+  - os: linux
+    dist: trusty
+    sudo: required
+    env: PLUMED_CC=mpicc PLUMED_CXX=mpic++ MAKEDOC=yes ALMOST=yes
 # the following are with debug flags
-# I think clang does not support debug-glibcxx, so I skip it here
-  - PLUMED_CC=gcc   PLUMED_CXX=g++    CONFIG_FLAGS="--enable-debug --enable-debug-glibcxx"
-  - PLUMED_CC=mpicc PLUMED_CXX=mpic++ CONFIG_FLAGS="--enable-debug --enable-debug-glibcxx"
-# then I try serial compilers
-  - PLUMED_CC=clang PLUMED_CXX=clang++
-  - PLUMED_CC=gcc   PLUMED_CXX=g++
+  - os: linux
+    dist: trusty
+    sudo: required
+    env: PLUMED_CC=gcc   PLUMED_CXX=g++    CONFIG_FLAGS="--enable-debug --enable-debug-glibcxx"
+  - os: linux
+    dist: trusty
+    sudo: required
+    env: PLUMED_CC=mpicc PLUMED_CXX=mpic++ CONFIG_FLAGS="--enable-debug --enable-debug-glibcxx"
 # then check with different optimization flags
-  - PLUMED_CC=clang PLUMED_CXX=clang++ PLUMED_CXXFLAGS=-O3 LAPACK=yes
-  - PLUMED_CC=gcc   PLUMED_CXX=g++     PLUMED_CXXFLAGS=-O3 LAPACK=yes
+  - os: linux
+    dist: trusty
+    sudo: required
+    env: PLUMED_CC=gcc   PLUMED_CXX=g++     PLUMED_CXXFLAGS=-O3 LAPACK=yes
+# then I try serial compiler on UBUNTU precise
+  - os: linux
+    dist: precise
+    sudo: required
+    env: PLUMED_CC=gcc   PLUMED_CXX=g++
 # test using external blas with internal lapack
-  - PLUMED_CC=mpicc PLUMED_CXX=mpic++  PLUMED_CXXFLAGS=-O3 LAPACK=yes CONFIG_FLAGS="--disable-external-lapack"
+  - os: linux
+    dist: trusty
+    sudo: required
+    env: PLUMED_CC=mpicc PLUMED_CXX=mpic++  PLUMED_CXXFLAGS=-O3 LAPACK=yes CONFIG_FLAGS="--disable-external-lapack"
+# osx serial
+  - os: osx
+    env: PLUMED_CC=clang PLUMED_CXX=clang++ PLUMED_CXXFLAGS=-O3
+# osx parallel
+  - os: osx
+    env: PLUMED_CC=mpicc PLUMED_CXX=mpic++  PLUMED_CXXFLAGS=-O3
 # cppcheck
-  - CPPCHECK=yes
+  - os: linux
+    sudo: required
+    env: CPPCHECK=yes
 # Possible additional variables:
 #   VALGRIND=yes to make valgrind tests, only when log contains string [valgrind]
 install:
@@ -32,25 +56,26 @@ install:
   - ./.travis/check.log makedoc  || MAKEDOC=no
   - ./.travis/check.log valgrind || VALGRIND=no
   - ./.travis/check.log almost   || ALMOST=no
+# update packages
+  - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update > /dev/null ; fi
+  - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get update -qq ; fi
 # install some package - these are fast, we install them anyway
-  - sudo apt-get update -qq
-  - sudo apt-get install -y libmatheval-dev
+  - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install -y libmatheval-dev ; fi
   - if test "$PLUMED_CXX" ; then ./.travis/install.xdrfile ; fi
 # cppcheck:
   - if test "$CPPCHECK" == yes ; then  ./.travis/install.cppcheck 1.69  ; fi
 # installation of these packages takes a lot of time
 # we do it only when needed
-  - if test "$PLUMED_CXX" == "mpic++" ; then sudo apt-get install -y libopenmpi1.5-dev openmpi1.5-bin ; fi
+  - if test "$PLUMED_CXX" == "mpic++" -a "$TRAVIS_OS_NAME" == "linux" ; then sudo apt-get install -y libopenmpi-dev openmpi-bin ; fi
+  - if test "$PLUMED_CXX" == "mpic++" -a "$TRAVIS_OS_NAME" == "osx" ;   then brew install openmpi ; fi
   - if test "$MAKEDOC" == yes ; then sudo apt-get install -y graphviz            ; fi
-# doxygen from its repository (apt-get gets an old version)
-#  - test "$MAKEDOC" == yes && ./.travis/install.doxygen                   || true
-# it seems that here we can get precompiled doxygen and latex
-  - if test "$MAKEDOC" == yes ; then sudo apt-add-repository -y ppa:libreoffice/ppa ; fi
-  - if test "$MAKEDOC" == yes ; then sudo apt-get update -qq                     ; fi
-  - if test "$MAKEDOC" == yes ; then sudo apt-get install -y doxygen doxygen-latex ; fi
+# install doxygen-latex
+  - if test "$MAKEDOC" == yes ; then sudo apt-get install -y doxygen-latex ; fi
+# then replace doxygen with the desided version
+  - if test "$MAKEDOC" == yes ; then ./.travis/install.doxygen Release_1_8_7 ; fi
   - if test "$VALGRIND" == yes ; then sudo apt-get install -y valgrind           ; fi
-  - if test "$LAPACK" == yes ; then sudo apt-get install libatlas-base-dev      ; fi
-  - if test "$ALMOST" == yes ; then sudo apt-get install libatlas-base-dev      ; fi
+  - if test "$LAPACK" == yes ; then sudo apt-get -y install libatlas-base-dev      ; fi
+  - if test "$ALMOST" == yes ; then sudo apt-get -y install libatlas-base-dev      ; fi
   - if test "$ALMOST" == yes ; then ./.travis/install.almost                     ; fi
   - if test "$ALMOST" == yes ; then ENALMOST="--enable-almost"                 ; fi
   - if test "$ALMOST" == yes ; then PLUMED_CPPFLAGS="-I$HOME/opt/include -I$HOME/opt/include/almost"  ; fi
diff --git a/.travis/install.doxygen b/.travis/install.doxygen
index 17e154c823d6f054fdabc0cfc26d74578e41f202..79b0ab2d8e2ba43038ebad9633d0323cb4a367aa 100755
--- a/.travis/install.doxygen
+++ b/.travis/install.doxygen
@@ -3,13 +3,6 @@
 set -e
 set -x
 
-sudo apt-get install -y texlive            
-sudo apt-get install -y texlive-fonts-extra
-sudo apt-get install -y latex-xcolor       
-sudo apt-get install -y texlive-extra-utils
-sudo apt-get install -y texlive-font-utils 
-sudo apt-get install -y texlive-full       
-
 git clone https://github.com/doxygen/doxygen.git
 
 cd doxygen