Spawn a new terminal window (Mac OS X)?

Solution 1:

You could use this little script to do what you want:

#!/bin/sh 
osascript <<END 
tell app "Terminal" to do script "cd \"`pwd`\"" 
END

place it in one of the folders in your path, make it executable (chmod +x filename) and run rehash. You can then run the name of this script to open a new terminal window in the same directory.

Src

Solution 2:

What you could do is the following.

Get the current environment in your clipboard:

env | pbcopy

Open up a new Terminal window and export those environment variables

for env in `pbpaste`; do export $env; done

And to ease the process, you could always alias it, like so

alias get_env="env | pbcopy"
alias set_env="for env in `pbpaste`; do export $env; done"

So that all you have to do is

get_env Command+N set_env

Solution 3:

open -a Terminal .

should do the trick. It simply opens the current directory . with the application Terminal. Of course, you can use any relative or absolute path instead of . such as :

open -a Terminal ..           # Parent directory
open -a Terminal ~/Documents  # User's documents
open -a Terminal /Library     # System library

Solution 4:

You could go to preferences -> general tab and look at the setting 'open new tab with', you can set terminal up to open a new tab in the current working directory.