diff --git a/macro/CMakeLists.txt b/macro/CMakeLists.txt
index da6622a1301c99c5f889ba1846e3da52f9c9c4fa..3698a4e48b63805f16622b03b02f82994bdbc67b 100644
--- a/macro/CMakeLists.txt
+++ b/macro/CMakeLists.txt
@@ -25,6 +25,10 @@ If($ENV{ctest_model} MATCHES Weekly)
   Message("Additional long running Weekly tests")
 EndIf()
 
+# Test if all libraries can be loaded
+GENERATE_TEST_SCRIPT(${CBMROOT_SOURCE_DIR}/scripts/checklibs.sh ${CBMROOT_BINARY_DIR}/macro/)
+add_test(load_libraries ${CBMROOT_BINARY_DIR}/macro/checklibs.sh)
+
 # Install in any case
 Install(FILES KF/DecayConfig.C KF/registerGeantDecays.C KF/registerLightIons.C KF/registerPythiaDecays.C
               KF/kf_kfparticle.C KF/kf_thermal_signal_generator.C  KF/kf_transport.C
diff --git a/scripts/checklibs.sh b/scripts/checklibs.sh
new file mode 100755
index 0000000000000000000000000000000000000000..d419e1054ba47d085bcac29de1c83f323cb30f09
--- /dev/null
+++ b/scripts/checklibs.sh
@@ -0,0 +1,40 @@
+#/!bin/bash
+
+# check if the libraries have the proper dependencies
+# load a single library in root and check the return value
+
+# Allow to run the script in th test suite without parameters
+# or from the command line passing the proper parameters
+SCRIPTDIR=${1:-$VMCWORKDIR/scripts}
+LIBDIR=${2:-../lib}
+
+# find all libs
+# libraries are real files with the extensions .so and for macosx .dylib
+all_libs=$(find $LIBDIR -type f | grep -e \.dylib -e \.so)
+
+tmpfile=$(mktemp)
+
+ok=true
+for lib in $all_libs; do
+  echo "Loading the library $lib"
+  root -l -q -b $SCRIPTDIR/loadlib.C\(\"$lib\"\) &> $tmpfile
+  retval=$?
+  if [[ retval -ne 0 ]]; then
+    echo ""
+    echo "Problem loading the library $lib"
+    cat $tmpfile
+    echo ""
+    okay=false
+  fi
+done
+
+rm $tmpfile
+
+if [[ "$okay" = "false" ]]; then
+  echo ""
+  echo "Not all libraries could be loaded"
+  echo "Test failed"
+  exit 1
+else
+  exit 0
+fi
diff --git a/scripts/loadlib.C b/scripts/loadlib.C
new file mode 100644
index 0000000000000000000000000000000000000000..334dc34843700e6a354f93d7c93f8193f3260d4c
--- /dev/null
+++ b/scripts/loadlib.C
@@ -0,0 +1,4 @@
+Int_t loadlib(TString libname) {
+  Int_t retval = gSystem->Load(libname);
+  return retval;
+}