diff --git a/.gitlab/before_script/freebsd/install_deps.sh b/.gitlab/before_script/freebsd/install_deps.sh
index c35fe9df2da279fd5c460058820fd4febc18ef93..b8bd04f8a67ea875efd6b448064ad4c435e52fea 100755
--- a/.gitlab/before_script/freebsd/install_deps.sh
+++ b/.gitlab/before_script/freebsd/install_deps.sh
@@ -8,7 +8,15 @@ set -eux
 
 mkdir -p "${TMPDIR}"
 
-curl -sSfL https://downloads.haskell.org/~ghcup/x86_64-portbld-freebsd-ghcup > ./ghcup-bin
+if freebsd-version | grep -E '^12.*' ; then
+	freebsd_ver=12
+elif freebsd-version | grep -E '^13.*' ; then
+	freebsd_ver=13
+else
+	(>&2 echo "Unsupported FreeBSD version! Please report a bug at https://gitlab.haskell.org/haskell/ghcup-hs/-/issues")
+	exit 1
+fi
+curl -sSfL https://downloads.haskell.org/~ghcup/x86_64-freebsd${freebsd_ver}-ghcup > ./ghcup-bin
 chmod +x ghcup-bin
 
 ./ghcup-bin -v upgrade -i -f