Fix cd with spaces

Closes #38.
Use system sed in osx to avoid local incompatible gnu sed installs

If people have installed gnu sed into /usr/local/bin, we don't
want to use it as it does not support the -l option.