Open a New Tab in Terminal.app in the Same Directory on Mac OS X

When working with Rails on my Mac OS X machine, I often find myself opening a lot of terminal tabs. Unfortunately I then need to navigate to the same directory as the other tabs. It's a big pain. Fortunately superuser.com has a solution.

Create a new file in "/usr/local/bin" named "nt"

#!/bin/bash
osascript -e 'tell application "Terminal"' \
-e 'tell application "System Events" to tell process "Terminal" to keystroke "t" using command down' \
-e "do script with command \"cd `pwd`;clear\" in selected tab of the front window" \
-e 'end tell' &> /dev/null

Then set its executable bit. "chmod +x /usr/local/bin/nt"

That's it!

If you made it this far, you should follow me on Twitter.

-JP

comments powered by Disqus