When you are working in the Finder and you discover that you need a terminal window you have to open "Terminal" and "cd" to the folder you were working on. With OpenTerminal you just click its icon or use the Finder's contextual menu and a terminal with the correct path shows up.
The advantage of OpenTerminal over other available tools is that it can run in the background (without using processor time) and react instantly because it doesn't have to start up first. It's also more refined than the other tools I know of: it
What's New
Version 2.07:
Works better with Mac OS X's Spaces feature
Includes some new workarounds for iTerm bugs
The alternative icon for the Finder's toolbar has been updated so it's no longer misaligned.
Has been using OpenTerminal for years. And still my best choice on OS X Lion.
However, after switched to iTerm2 from iTerm, I found OpenTerminal didn't work with iTerm2. Wish the developer add the support for iTerm2 as well.
I used this app with iKey and mapped MAC+F1 to open iTerm here which saved me lot of time. I would definitely purchase this app if it goes on AppStore. Anyway, thx a lot for the developer for his work.
@monoclast:
Thanks for the "cdf" idea. But the script failed to work when the pathname contains white spaces. I've tweaked the script for a work-around:
alias cdf="eval "cd \"\`osascript -e 'tell app \\\"Finder\\\" to return the POSIX path of (target of window 1 as alias)'\`\"""
Adding this line to ~/.bashrc, and every terminal environment could "cdf" to the directory of the frontmost Finder window.
@monoclast:
Thanks for the "cdf" idea. But the script failed to work when the pathname contains white spaces. I've tweaked the script for a work-around:
alias cdf="eval "cd \"\`osascript -e 'tell app \\\"Finder\\\" to return the POSIX path of (target of window 1 as alias)'\`\"""
Adding this line to ~/.bashrc, and every terminal environment could "cdf" to the directory of the frontmost Finder window.
By far the best approach for anyone who is a heavy cli user. cdto is buggy, not updated, and relies on appscript for iTerm. The background app is also a different approach than most so its speed is a bit faster.
Oh, I'm sorry, I don't use the contextual menu myself and hadn't even noticed that it doesn't work in Snow Leopard anymore. Since Snow Leopard (in 64-bit mode) doesn't support contextual menu plugins at all, I have added a "service" that can be displayed in the contextual menu in Snow Leopard's Finder.
If you find another bug, please e-mail me directly and I'll try to help more quickly. (You can find my e-mail address at the bottom of the readme file.)
Thanks for sharing this idea!
I have added your instructions to the OpenTerminal readme file. I've slightly modified them to work with OpenTerminal, so that "cdf" can use OpenTerminals functionality (support for Unicode file names, cd to the desktop if no windows are open, cd to the trash folder, etc.)
An especially cool thing with your command is that it works with every terminal application including xterm.
For anyone interested, I accomplish the same thing with a simple addition to my ~/.bashrc file:
####################################################################
# implement cdf command #
# (changes the working dir to the front-most window of the Finder) #
####################################################################
cdf()
{
eval cd "`osascript -e 'tell app "Finder" to return the quoted form of the POSIX path of (target of window 1 as alias)' 2>/dev/null`"
}
With this added to your .bashrc file, you can open a terminal window and type "cdf" to change the working directory to the front-most Finder window.
Because "." does not expand to "the current front-most Finder window". It expands to "the current working directory", which is not nearly the same thing. Try it.
I like this a lot, except that it doesn't seem to work well with Visor. I hope the developer can get that working. Perhaps in cooperation with the developers of Visor?
It seems to work if you choose the "Use an existing Terminal session if possible" option and disable the "Use tabs instead of windows" option in OpenTerminal's preferences (hold down the option key while launching OpenTerminal to open the preferences window).
If it still doesn't work, please e-mail me.
Well, that does make it work somewhat, but it doesn't open up the visor. It works invisibly, and then I need to bring up the Visor to see it. That will work for now, but any chance you could get it to open the Visor too?
I've made a very small change to OpenTerminal (so no new version number) and it can now open Visor. "Show on relaunch" must be selected in the Visor preferences.
Just redownload OpenTerminal and e-mail me if it doesn't work.
Unfortunately, Leopard's Terminal.app has no "make new tab" AppleScript command. However, OpenTerminal 2.0.4 supports tabs in Terminal windows if you have UI scripting turned on.
Please login or create a new MacUpdate Member account to use this feature
Watch Lists are available to MacUpdate Desktop Members Upgrade Now
Download and auto-install
using MacUpdate Desktop. Save
time moving folders and cleaning-up.
OpenTerminal opens the Terminal with cd command.
When you are working in the Finder and you discover that you need a terminal window you have to open "Terminal" and "cd" to the folder you were working on. With OpenTerminal you just click its icon or use the Finder's contextual menu and a terminal with the correct path shows up.
The advantage of OpenTerminal over other available tools is that it can run in the background (without using processor time) and react instantly because it doesn't have to start up first. It's also more refined than the other tools I know of: it includes workarounds for several Finder and Terminal bugs, supports Spaces, and it doesn't open superfluous terminal windows.
+14
Jichi reviewed on 04 Jan 2012
However, after switched to iTerm2 from iTerm, I found OpenTerminal didn't work with iTerm2. Wish the developer add the support for iTerm2 as well.
I used this app with iKey and mapped MAC+F1 to open iTerm here which saved me lot of time. I would definitely purchase this app if it goes on AppStore. Anyway, thx a lot for the developer for his work.
+1
+79
Thanks for the "cdf" idea. But the script failed to work when the pathname contains white spaces. I've tweaked the script for a work-around:
alias cdf="eval "cd \"\`osascript -e 'tell app \\\"Finder\\\" to return the POSIX path of (target of window 1 as alias)'\`\"""
Adding this line to ~/.bashrc, and every terminal environment could "cdf" to the directory of the frontmost Finder window.
+79
All the backslashes showed up there shall be doubled:
alias cdf="eval \"cd \\\"\\\`osascript -e 'tell app \\\\\\\"Finder\\\\\\\" to return the POSIX path of (target of window 1 as alias)'\\\`\\\"\""
+79
Thanks for the "cdf" idea. But the script failed to work when the pathname contains white spaces. I've tweaked the script for a work-around:
alias cdf="eval "cd \"\`osascript -e 'tell app \\\"Finder\\\" to return the POSIX path of (target of window 1 as alias)'\`\"""
Adding this line to ~/.bashrc, and every terminal environment could "cdf" to the directory of the frontmost Finder window.
+2
+1
+53
Crunc reviewed on 29 Jul 2010
+4
If you find another bug, please e-mail me directly and I'll try to help more quickly. (You can find my e-mail address at the bottom of the readme file.)
+1
TexLogic reviewed on 25 Jan 2008
+10
I have added your instructions to the OpenTerminal readme file. I've slightly modified them to work with OpenTerminal, so that "cdf" can use OpenTerminals functionality (support for Unicode file names, cd to the desktop if no windows are open, cd to the trash folder, etc.)
An especially cool thing with your command is that it works with every terminal application including xterm.
+46
####################################################################
# implement cdf command #
# (changes the working dir to the front-most window of the Finder) #
####################################################################
cdf()
{
eval cd "`osascript -e 'tell app "Finder" to return the quoted form of the POSIX path of (target of window 1 as alias)' 2>/dev/null`"
}
With this added to your .bashrc file, you can open a terminal window and type "cdf" to change the working directory to the front-most Finder window.
-8
cdf()
{
open .
}
;)
+46
+53
If it still doesn't work, please e-mail me.
+53
Just redownload OpenTerminal and e-mail me if it doesn't work.
+53
+3
+3
+3
Kuean rated on 19 Dec 2010