diff --git a/tests/Makefile.am b/tests/Makefile.am
index 823641da4cfa52963b481974da89f609cd3b3902..df950cf4ffb5c1f9433af3950a5b925c85e6af86 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1435,7 +1435,7 @@ check-matlab-ols: $(M_OLS_TRS_FILES)
 %.o.trs %.o.log: %.mod
 	@echo "`tput bold``tput setaf 8`OCTAVE: $(CURDIR)/$*... `tput sgr0`"
 	@DYNARE_VERSION="$(PACKAGE_VERSION)" TOP_TEST_DIR="$(CURDIR)" FILESTEM="$*" \
-		$(OCTAVE) --no-init-file --silent --no-history --path "$*.mod" run_test_octave.m > $*.o.log 2>&1 || \
+		$(OCTAVE) --no-window-system --no-init-file --silent --no-history --path "$*.mod" run_test_octave.m > $*.o.log 2>&1 || \
 	printf ":test-result: FAIL\n:number-tests: 1\n:number-failed-tests: 1\n:list-of-failed-tests: $*.mod\n:elapsed-time: 0.0\n" > $*.o.trs
 	@if test -z "$(filter $*.o.trs,$(O_XFAIL_TRS_FILES))"; then pass_color=2; fail_color=1; else pass_color=1; fail_color=2; fi; \
 	if grep -q ":test-result: PASS" $*.o.trs; then \
@@ -1450,7 +1450,7 @@ check-matlab-ols: $(M_OLS_TRS_FILES)
 %.o.trs %.o.log : %.m
 	@echo "`tput bold``tput setaf 8`OCTAVE: $(CURDIR)/$*... `tput sgr0`"
 	@DYNARE_VERSION="$(PACKAGE_VERSION)" TOP_TEST_DIR="$(CURDIR)" \
-		$(OCTAVE) --no-init-file --silent --no-history $< > $*.o.log 2>&1 || \
+		$(OCTAVE) --no-window-system --no-init-file --silent --no-history $< > $*.o.log 2>&1 || \
 		printf ":test-result: FAIL\n:number-tests: 1\n:number-failed-tests: 1\n:list-of-failed-tests: $*.m\n:elapsed-time: 0.0\n" > $*.o.trs
 	@echo "`tput bold``tput setaf 8`OCTAVE: $(CURDIR)/$* Done!`tput sgr0`"
 
@@ -1464,7 +1464,7 @@ check-matlab-ols: $(M_OLS_TRS_FILES)
 %.o.tls : %.m
 	@echo "`tput bold``tput setaf 8`OCTAVE: $(CURDIR)/$*... `tput sgr0`"
 	@TOP_TEST_DIR="$(CURDIR)"  FILESTEM="$*" \
-		$(OCTAVE) --no-init-file --silent --no-history run_o_script.m 2>&1
+		$(OCTAVE) --no-window-system --no-init-file --silent --no-history run_o_script.m 2>&1
 	@touch $*.o.tls
 	@echo "`tput bold``tput setaf 8`OCTAVE: $(CURDIR)/$* Done!`tput sgr0`"
 
diff --git a/tests/run_block_byte_tests_octave.m b/tests/run_block_byte_tests_octave.m
index b6319ca272b9b930165a9d77b3a6c863c325ccc5..d2533a14279cd9a98d50305a880b5ec123a4d31b 100644
--- a/tests/run_block_byte_tests_octave.m
+++ b/tests/run_block_byte_tests_octave.m
@@ -30,11 +30,6 @@ if !strcmp(dynare_version(), getenv("DYNARE_VERSION"))
     error("Incorrect version of Dynare is being tested")
 endif
 
-## Ask gnuplot to create graphics in text mode
-## Note that setenv() was introduced in Octave 3.0.2, for compatibility
-## with MATLAB
-putenv("GNUTERM", "dumb")
-
 ## Test block_bytecode/ls2003.mod with various combinations of
 ## block/bytecode/solve_algo/stack_solve_algo
 failedBlock = {};
diff --git a/tests/run_reporting_test_octave.m b/tests/run_reporting_test_octave.m
index 96ea7e35ac97ea2c226ca42bac3855f8e1e521a1..df23692179c6fb0626189e49de84a87e9a6fe54f 100644
--- a/tests/run_reporting_test_octave.m
+++ b/tests/run_reporting_test_octave.m
@@ -1,4 +1,4 @@
-## Copyright (C) 2013-2019 Dynare Team
+## Copyright (C) 2013-2022 Dynare Team
 ##
 ## This file is part of Dynare.
 ##
@@ -25,11 +25,6 @@ if !strcmp(dynare_version(), getenv("DYNARE_VERSION"))
     error("Incorrect version of Dynare is being tested")
 endif
 
-## Ask gnuplot to create graphics in text mode
-## Note that setenv() was introduced in Octave 3.0.2, for compatibility
-## with MATLAB
-putenv("GNUTERM", "dumb")
-
 ## To add default directories, empty dseries objects
 dynare_config();
 
diff --git a/tests/run_test_octave.m b/tests/run_test_octave.m
index e628fa1880b806c50556aa793e4b13da463974a5..1fdfeb58017baa2a2616345d2108769886208ffa 100644
--- a/tests/run_test_octave.m
+++ b/tests/run_test_octave.m
@@ -1,4 +1,4 @@
-## Copyright (C) 2009-2017 Dynare Team
+## Copyright (C) 2009-2022 Dynare Team
 ##
 ## This file is part of Dynare.
 ##
@@ -32,10 +32,6 @@ if !strcmp(dynare_version(), getenv("DYNARE_VERSION"))
     error("Incorrect version of Dynare is being tested")
 endif
 
-## Ask gnuplot to create graphics in text mode
-graphics_toolkit gnuplot;
-setenv("GNUTERM", "dumb");
-
 ## Test MOD files listed in Makefile.am
 name = getenv("FILESTEM");
 [directory, testfile, ext] = fileparts([top_test_dir '/' name]);