diff --git a/vcsh b/vcsh
index 1fc78e2383ca522e62e9b82a381ab42803fb6ae8..cf0c8cf1d3dacfcf69cc6a0a95c050527881a419 100755
--- a/vcsh
+++ b/vcsh
@@ -365,7 +365,11 @@ write_gitignore() {
 			file="$new"
 		done;
 	done | sort -u)
-	tempfile=$(mktemp) || fatal "could not create tempfile" 51
+
+	# Contrary to GNU mktemp, mktemp on BSD/OSX requires a template for temp files
+	# Use the template GNU mktemo defaults to
+	tempfile=$(mktemp tmp.XXXXXXXXXX) || fatal "could not create tempfile" 51
+
 	echo '*' > "$tempfile" || fatal "could not write to '$tempfile'" 57
 	for gitignore in $gitignores; do
 		echo "$gitignore" | sed 's@^@!/@' >> "$tempfile" || fatal "could not write to '$tempfile'" 57