updated tty helpers from homebrew