I use the ruby program rak
to recursively search directories for a text pattern. Occassionally when rak
is done returning results it will scramble the terminal output into unreadable garbage.
The solution for this on OS X is to issue the following command:
tput rmacs
Found this solution somewhere else initially, but now I've found it again at stackoverflow.