Make cli build on freebsd
system: add IsSafe for freebsd
system: add SafeTempDir for freebsd