2007년 03월 16일
Finder의 폴더에서 터미널 바로 띄우기
유닉스 명령에 익숙한 사람이라면 Finder 로 파일을 검색하던 도중, 특정한 폴더 내용에 대해서 터미널 명령을 사용하고 싶을 때가 있을 것이다. 지금 현재 Finder에서 선택된 폴더의 위치에서 터미널을 바로 열 수 있도록 하는 방법을 알아보도록 하자.
1. 오토메이터 실행.

2. Library 에서 'Finder', Action에서 'Get Selected Finder item' 을 선택

3. Library (Automator), Action 에서 'Run AppleScript' 를 선택

4. 다음의 스크립트를 'Run AppleScript' 내의 (* Your script goes here *) 위치에 붙여넣는다.
set myWin to window 1
set theWin to (quoted form of POSIX path of (target of myWin as alias))
tell application "Terminal"
activate
tell window 1
do script "cd " & theWin
end tell
end tell
end tell
set myWin to window 1
set theWin to (quoted form of POSIX path of (target of myWin as alias))
tell application "iTerm"
make new terminal
tell the first terminal
activate current session
launch session "Default Session"
tell the last session
write text "cd " & theWin
end tell
end tell
end tell
end tell
tell application "Finder"
activate
end tell
tell application "iTerm"
activate
end tell
완료되면 대략 이런 모습이 된다.

5. 이제 이렇게 만들어진 오토메이터 워크플로우를 파인더에 연결한다. 메뉴에서 'File - Save As PlugIn' 을 선택

5. 이제 파인더에서 터미널을 열 폴더를 선택하고, 단축메뉴의 'Automator' 항목에서 'Open in Terminal' 을 선택하면

6. 현재 선택된 파인더 폴더에서 터미널이 시동된다.

7. iTerm 을 시동시킨 모습. iTerm 은 탭으로 동시에 여러개의 세션을 띄울 수 있으므로 편리하다.

1. 오토메이터 실행.

2. Library 에서 'Finder', Action에서 'Get Selected Finder item' 을 선택

3. Library (Automator), Action 에서 'Run AppleScript' 를 선택

4. 다음의 스크립트를 'Run AppleScript' 내의 (* Your script goes here *) 위치에 붙여넣는다.
- 일반적인 terminal 이용자
set myWin to window 1
set theWin to (quoted form of POSIX path of (target of myWin as alias))
tell application "Terminal"
activate
tell window 1
do script "cd " & theWin
end tell
end tell
end tell
- iTerm 이용자
set myWin to window 1
set theWin to (quoted form of POSIX path of (target of myWin as alias))
tell application "iTerm"
make new terminal
tell the first terminal
activate current session
launch session "Default Session"
tell the last session
write text "cd " & theWin
end tell
end tell
end tell
end tell
tell application "Finder"
activate
end tell
tell application "iTerm"
activate
end tell
완료되면 대략 이런 모습이 된다.

5. 이제 이렇게 만들어진 오토메이터 워크플로우를 파인더에 연결한다. 메뉴에서 'File - Save As PlugIn' 을 선택

5. 이제 파인더에서 터미널을 열 폴더를 선택하고, 단축메뉴의 'Automator' 항목에서 'Open in Terminal' 을 선택하면

6. 현재 선택된 파인더 폴더에서 터미널이 시동된다.

7. iTerm 을 시동시킨 모습. iTerm 은 탭으로 동시에 여러개의 세션을 띄울 수 있으므로 편리하다.

# by | 2007/03/16 01:00 | OS X | 트랙백(1) | 핑백(1) | 덧글(1)




☞ 내 이글루에 이 글과 관련된 글 쓰기 (트랙백 보내기) [도움말]
제목 : iTerm 사용 팁 하나... 파인더와의 유기적인 ..
시작하기 전에...이 팁은 DZone Snippets라는 곳에 올라와 있는 코드를 바탕으로 정리해 놓은 것입니다.윈도우즈라면 탐색기, 맥이라면 파인더, 리눅스 환경이라면 노틸러스 같은 애플리케이션을 사용하다 보면 현재 창이 열려져 있는 폴더에서 셸 명령어를 사용하고 싶은 경우가 종종 있습니다.이럴 때 터미널을 열어서 cd 명령으로 일일이 그 디렉토리까지 이동하려면 꽤 번거롭습니다.맥에서는 애플스크립트를 활용해서 파인더에서 바로 iTerm을 열면......more
... Finder의 폴더에서 터미널 바로 띄우기 이전에 이런 글을 썼었는데 그때는 애플스크립트와 오토메이터를 이용한 방법. 이번에 소개할 것은 파인더 툴바에 버튼을 넣어 누르면 바로 현재 폴더를 ... more