OS X: reveal file in console
One of the neat things you can do in OS X is to reveal a file in Finder.app from some other applications. Turns out lots of the time, we also want to do that in the terminal. The following script helps you with that:
#!/usr/bin/osascript
on run args
set fullpath to do shell script "realpath " & (quoted form of first item of args)
set theFile to POSIX file fullpath
tell application "Finder"
reveal theFile
activate
end tell
end
Note:
- You should put this into a directory in your search path. I recommend in
~/bin
. Also remember tochmod +x
. - The above requires another script
realpath
, which returns the fullpath of a file. You can find it here.
Comments