diff --git a/tools/dsh/main.cpp b/tools/dsh/main.cpp
index dd9cf6feef86d801356a94c877b3fc50e567e1d1..78d9593c28b4c41a30215c4fee96e08e3e02e0f5 100644
--- a/tools/dsh/main.cpp
+++ b/tools/dsh/main.cpp
@@ -23,6 +23,12 @@
 #include <getopt.h>
 
 #include <netinet/in.h>
+#if __has_include(<fmt/std.h>)
+#include <fmt/std.h>
+#else
+#include <fmt/ostream.h>
+#endif
+
 
 struct dhtsh_params
 {