I bought a macbook pro retina 13" few days ago. I have never had a mac before and I don't know where can I set the computer to keep running when I close the display.

The laptop came with os x 10.8.4.

Any help?


Question: AppleScript: how to get the current directory of the topmost Terminal
Answer: Another solution.

get_foregroundterminal_curdir_fast.scpt:

tell application "Terminal"
    do shell script "lsof -a -p `lsof -a -c bash -u $USER -d 0 -n | tail -n +2 | awk '{if($NF==\"" &amp; (tty of front tab of front window) &amp; "\"){print $2}}'` -d cwd -n | tail -n +2 | awk '{print $NF}'"
end tell


I use lsof itself to get PID of the bash shell of the corresponding Terminal window. This is MUCH faster than using fuser (milliseconds vs. seconds).