OS X for Linux users

Some things just seem more difficult in OS X, but they need not be. Here are some tips for making OS X easier to use if you think like a Linux user. Anything preceded by a '$' on this page is intended to be typed at the shell.

Opening applications

When working in an xterm, it is sometimes useful to bring up the current directory in the OS X Finder:

$ open .

(Other directories can be opened by substituting the directory name for '.'.)

Changing the xterm directory to that shown in Finder

The reverse of the above task is to change the current working directory in the xterm to that being shown by the topmost Finder. Inclusion of the following function in ~/.bashrc will define a new command, cdfinder, to do this. (I found this at Josh Malone's Collection of Mac Tidbits. Some other useful tips are there too.)

cdfinder () {
cd "$(osascript -e 'tell application "Finder"' \
  -e 'set myname to POSIX path of (target of window 1 as alias)' \
  -e 'end tell' 2>/dev/null)"

Opening a file with a specific application from an xterm

Linux users will be used to opening a file like this:

$ emacs file.txt &

In OS X this will only work for applications in the path, and not for the OS X applications in the Applications folder. OS X applications can instead be started directly from the xterm with open:

$ open -a /Applications/Aquamacs\ Emacs.app myfile.tex

Omit the '-a' to use the default application:

$ open wordfile.doc

Omit the argument after the application to open it without specifying a file:

$ open -a /Applications/Thunderbird.app