“Finder”창의 인스턴스를 마우스 오른쪽 버튼으로 클릭하여 “여기에서 터미널 열기”라는 옵션이 있는지 궁금합니다. 정말 도움이 될 것입니다.
답변
Mac OS X Lion 10.7부터 터미널은 Finder에서 선택한 폴더의 새 터미널 창 또는 탭을 여는 서비스를 제공합니다. 또한 텍스트 (모든 응용 프로그램에서)에서 선택된 절대 경로 이름으로 작업합니다. 시스템 환경 설정> 키보드> 키보드 단축키> 서비스를 사용하여 이러한 서비스를 활성화 할 수 있습니다 . “폴더의 새 터미널”및 “폴더의 새 터미널 탭”을 찾으십시오. 바로 가기 키를 할당 할 수도 있습니다.
또한 폴더 및 경로 이름을 터미널 응용 프로그램 아이콘으로 끌어서 새 터미널 창을 열거 나 터미널 창의 탭 표시 줄로 끌어 해당 창에 새 탭을 만들 수 있습니다. 터미널보기가 아닌 탭으로 드래그 cd
하면 추가 입력없이 해당 디렉토리로 전환하기 위한 완전한 명령 이 실행 됩니다.
OS X Mountain Lion 10.8부터 터미널로의 명령 드래그는 완전한 cd
명령을 실행합니다 .
참고 : Finder에서 폴더를 선택하면 폴더 의 새 터미널 서비스가 활성화 됩니다 . 단순히 폴더를 열고 “제자리에서”서비스를 실행할 수는 없습니다. 상위 폴더로 돌아가서 관련 폴더를 선택한 다음 서비스 메뉴 또는 컨텍스트 메뉴를 통해 서비스를 활성화하십시오.
답변
답변
답변
cdto 는 필요한 것 같습니다. 이 응용 프로그램은 Finder의 도구 모음에 배치되도록 설계된 미니 응용 프로그램입니다. 실행하면 터미널 창이 열리고 cd
Finder의 현재 디렉토리 가 열립니다 .
답변
iTerm을 사용하는 사용자의 경우 AppleScript 구문이 iTerm 버전 3에서 변경되었습니다. 다음은 Finder에서 바로 가기를 생성하기위한 전체 절차입니다.
-
Automator를 시작하십시오.
-
“응용 프로그램”을 선택하십시오.
- “Applescript 실행”을 선택하십시오.
-
아래 코드를 붙여 넣으십시오.
-- get the current directory in Finder on run {input, parameters} tell application "Finder" set _cwd to quoted form of (POSIX path of (folder of the front window as alias)) end tell CD_to(_cwd) end run -- change directory in iTerm (version >= 3) on CD_to(_cwd) tell application "iTerm" activate try set _window to first window on error set _window to (create window with profile "Default") end try tell _window tell current session write text "cd " & _cwd & ";clear;" end tell end tell end tell end CD_to
-
“파일”-> “내보내기”를 클릭하여로 내보내고
.app
저장하십시오/Applications
. -
다음을 누른 상태에서 응용 프로그램을 Finder 아이콘 막대로 이동하십시오 ⌘.
완료!
여기 지침에 따라 Finder에서 아이콘을 변경할 수 있습니다 (Automator로 생성 한 응용 프로그램의 아이콘 변경).
답변
나는 주로이 기능을 사용한다 :
cf() {
cd "$(osascript -e 'tell app "Finder" to POSIX path of (insertion location as alias)')"
}
아래와 같은 스크립트에 단축키를 지정할 수도 있습니다.
기존 탭을 재사용하거나 새 창을 작성하십시오 (터미널).
tell application "Finder" to set p to POSIX path of (insertion location as alias)
tell application "Terminal"
if (exists window 1) and not busy of window 1 then
do script "cd " & quoted form of p in window 1
else
do script "cd " & quoted form of p
end if
activate
end tell
기존 탭을 재사용하거나 새 탭을 작성하십시오 (터미널).
tell application "Finder" to set p to POSIX path of (insertion location as alias)
tell application "Terminal"
if not (exists window 1) then reopen
activate
if busy of window 1 then
tell application "System Events" to keystroke "t" using command down
end if
do script "cd " & quoted form of p in window 1
end tell
항상 새 탭을 작성하십시오 (iTerm 2).
tell application "Finder" to set p to POSIX path of (insertion location as alias)
tell application "iTerm"
if exists current terminal then
current terminal
else
make new terminal
end if
tell (launch session "Default") of result to write text "cd " & quoted form of p
activate
end tell
처음 두 스크립트는 10.7에서 추가 된 서비스와 비교하여 몇 가지 장점이 있습니다.
- 10.9부터는 입력으로 폴더를받는 서비스가 열보기의 서비스 메뉴에 나열되지 않는 버그가 있습니다. 폴더 서비스의 새 터미널 탭에 바로 가기 키를 할당하면 열보기에서 작동하지 않습니다.
- 먼저 폴더를 선택하지 않고 제목 표시 줄의 폴더를 사용합니다.
- 명령을 실행하거나 매뉴얼 페이지를 표시하거나 emacs를 실행하는 등 바쁘지 않은 경우 맨 앞 탭을 재사용합니다.
10.7 또는 10.8을 사용하는 경우 다음으로 변경 tell application "Finder" to set p to POSIX path of (insertion location as alias)
하십시오.
tell application "Finder"
if exists Finder window 1 then
set p to POSIX path of (target of Finder window 1 as alias)
else
set p to POSIX path of (path to desktop)
end if
end tell
10.7 및 10.8에는 버그가 있지만 (10.9 또는 10.6은 아님) 마지막으로 포커스를 다른 응용 프로그램으로 옮긴 후 생성 된 창을 무시하고 insertion location
속성을 가져올 때 Finder가 Finder를 무시하는 버그가 있습니다.
답변
서비스 기능으로이를 수행 할 수 있습니다.
다음 사이트에는 이러한 서비스의 예가 포함되어 있습니다.
http://blog.leenarts.net/2009/09/03/open-service-here/