diff --git a/vcsh b/vcsh
index 62310a7293ab5485839cccf1162d39b9acf184ff..3d08f227ab68ff776850be232ab3f4e5b1aba062 100755
--- a/vcsh
+++ b/vcsh
@@ -4,6 +4,18 @@
 
 SELF=$(basename $0)
 [ -z $XDG_CONFIG_HOME ] && XDG_CONFIG_HOME="$HOME/.config"
+for dir in $XDG_CONFIG_HOME $XDG_CONFIG_HOME/vcsh $XDG_CONFIG_HOME/vcsh/repo.d
+do
+
+    if [ ! -d $dir ]; then
+        if [ -e $dir ]; then
+            echo "$SELF: error: $dir exists but is not a directory" >&2
+            return 2
+        else
+            mkdir $dir || (echo "$SELF: error: could not create $dir" >&2; return 2)
+        fi  
+    fi
+done
 VCSH_BASE="$XDG_CONFIG_HOME/vcsh/repo.d"
 
 help() {