Path into PS1 prompt is broken (\n) on different lines when it is too long
It's a bug related to the old version of bash included in macOS. 

To overcome you can


Switch to zsh (see What are the practical differences between Bash and Zsh?) 
Install a more recent version of bash via Homebrew and use this as your standard shell (see How to use bash as default shell)