Mac OS X for Oceanographers and Atmospheric Scientists

(or anybody else who's used to Unix)


Last modified: Thu Mar 13 13:50:12 2008

Howdy. This is a journal of sorts about how I have adapted my Mac OS X machine to work with the GNU and Unixy tools which I consider standard for earth sciences. All of this stuff works natively under Linux, and therefore is quite portable to Darwin systems. There is also a minimal discussion of some of the standard add-ons and widgets that are offered for OS X.


Mailing list

The most recent information is available on the mailing list archives! Browse conversation threads or google-search this site:
Google
WWW tazman.princeton.edu

I can only update the information on these pages sporadically, when other commitments permit. I get plenty of email suggesting alternative strategies for tackling some of the issues presented here, and I rarely have a chance to work that material in. Most importantly, I think others should have a forum to express their opinions on these issues. So, I've created a mailing list. You don't have to subscribe to view or search the archives, but you do have to subscribe if you want to post a message to the list. Importantly, subscribers can opt to not receive messages sent to the list...I think this might be useful. You are still welcome to email me with comments, suggestions, tirades. However, I would prefer that you send your comments to the list. Who knows, maybe you'll get a response more quickly that way.

OSX mailing list:



Links to other sites of interest There are lots of other resources like this one on the web. Check them out!




Compilers, Numerics, and Programming

XCode: Apple's Developer Tools You really, really should install these. They are not installed by default; you must open the Xcode folder on the OS X installation DVD and double-click the package file there (looks like a cardboard box). You can also get Xcode from Apple's website. One must register with Apple's "developer connection" in order to get the tools and their updates. Go to http://developer.apple.com/macosx/ to sign up.

High Performance Computing

Gaurav Khanna has done a much better job of discussing HPC issues than I ever could, so if you're interested in F90, MPI, clustering, etc., please just visit his site at http://hpc.sourceforge.net/.

GNU C++ extensions

I accidentally discovered that some of the stuff I coded on Linux uses GNU extensions to the standard C++ library. These are not present in OS X's libstdc++. Oops. One such extension is a method for initializing an input or output stream with a FILE* file descriptor. Luckily, Nicolai Josuttis, author of the most excellent book "The C++ Standard Library--A Tutorial and Reference" has offered up a portable implementation called fdstream.hpp.


X server

Leopard (OS X 10.5) update

Apple's X11.app is installed by default on new machines (those that come with 10.5 pre-installed). I would be unsurprised to learn that X11 is now installed by default on upgrade installs, as well. See this mail message for more details of X11 on Leopard.

This is a "must have". I suggest that you install Apple's X11 software, which is unfortunately (a) not installed by default and (b) semi-hidden in the OS X installation DVD. Insert the DVD, and scroll down until you see all the other contents. Click on the "Optional Installs" package file (looks like a cardboard box). Click through all the licensing screens until you get to a list of potential installs. Click on the little triangle next to "Applications", then locate and check the X11 box. Don't bother with the other applications (Safari, iCal, etc.); unless things are really out of order on your machine, they are already installed. Proceed with installation. Consider using the DISPLAY hack in my .cshrc file, http://tazman.princeton.edu/osx/dot-cshrc.

I don't want an xterm

The file ~/.Xinitrc controls what programs are started automatically when X11.app is launched. Mine looks like:
/sw/bin/gkrellm &
exec quartz-wm
You can get rid of the potentially-annoying xterm by removing it from the default version of this file. Do not remove the last line, nor put anything after it. It starts Apple's X11 window manager. In principle, this can be replaced by some other window manager, but you probably don't want to do that.

X11 Preferences Tweaks

There are two useful changes that one can make to one's own X11 preferences via the command line utility "defaults". These cannot be accessed from the Preferences menu. The first enables focus-follows-mouse in X11:
defaults write com.apple.x11 wm_ffm true
and the second eliminates the annoying "Are you sure you really want to quit X11.app?" dialog that comes up when you try to reboot. I find this particularly helpful to get around X11's default behavior of cancelling logout after a software update that requires rebooting:
defaults write com.apple.x11 no_quit_alert true
You can see the effects of this command by inspecting the XML file ~/Library/Preferences/com.apple.X11.plist, or by typing
defaults read com.apple.x11





Also a "must have", and I'm sorry to report, undoubtedly the most annoying part of setting up a new OS X machine. This is a collection of hundreds (thousands?) of applications ported from the open source world. I should mention that DarwinPorts (http://darwinports.opendarwin.org/) is a potential alternative to fink, but appears to be significantly less user friendly. (Reports to the contrary are always welcome.)

Follow instructions at the Fink homepage, http://fink.sourceforge.net to download and run the fink installer. After this is done, you can install binary packages with "sudo apt-get packagename". If you tend to the masochistic, you may want to download the source code and compile it from scratch, for which "sudo fink install packagename" is the proper incantation. Note that compilation from source can take a surprisingly long time! Ask someone who compiled KDE this way, for instance. As a rule of thumb, I recommend that you use apt-get to install binary versions. The all-too-frequent exception to this rule is when something you want isn't yet available in binary form, and you have to compile from source using fink install. If you're familiar with Debian, fink will immediately make sense. The tools are built on the Debian apt system. The file /sw/etc/fink.conf controls which repositories will be searched for your software requests. As with Debian, most of the action is happening in the "unstable" branches. In my experience, there is little risk in having the unstable directories listed in fink.conf, but people who are uncomfortable with command-line work should perhaps stick with the stable branch.

One of the annoyances with fink is that it always seems like the stuff I need is not available in the "stable" tree. I always have to do a "fink selfupdate" and grab stuff from the unstable tree. In summary, my recipe for fink installs goes something like:

Some people apparently like the GUI "fink commander". I don't know anything about it.



I hate CAPS LOCK! (formerly, uControl)

For Tiger

Apple now offers a partial solution to the modifier-key remapping problem. See this thread on the ucontrol mailing list: http://sourceforge.net/mailarchive/forum.php?thread_id=7032300&forum_id=36416 for details. This is great news, because it apparently fixes a long-standing complaint about keystroke collisions in the keyboard buffer (translation: if you type too fast using ucontrol, sometimes the control key gets stuck on and requires another hit on caps lock to turn off. Annoying and potentially destructive in emacs!)

However, Tiger does not allow remapping the silly "enter" key to Fn, which as described above is really useful for one-handed pgup/pgdn. For this single purpose, I use DoubleCommand (available at http://doublecommand.sourceforge.net/). Works great!

For pre-Tiger OS X

Use this wonderful utility to turn your caps-lock into another ctrl key, the way it should be. (This is perhaps most important for Powerbook users.) Also can do other useful remappings like turning the 'enter' key just to the right of the space bar into another command or function key. Find it at http://www.gnufoo.org/ucontrol/ucontrol.html.

I have my caps lock mapped to a control key, and the enter key mapped to function. This second mapping allows me to do a pageup/pagedown with just one hand (nice!).

I do have one complaint about this utility. The caps lock key causes an irritation for me if I sleep my laptop when the key's light is on. (The light still goes on and off as if the key were toggling a real caps lock, even though uControl is making it act like a control key.) If the laptop wakes up from sleep with the light on, it thinks I'm holding down the control key, so all key presses and mouse clicks are treated as control-whatever. Simply hitting the key once returns it to normal behavior.

If you are using a USB keyboard (not true for laptops), there's a simpler solution. See http://www.macosxhints.com/article.php?story=20020222094159459 for details.




CodeTek Virtual Desktop

Leopard update

This section discusses the virtual desktop functionality which is now offered by default on OS X 10.5 (Leopard). Prior to 10.5, one had to jump through hoops to get desktops on OS X. Now, you can skip this section.

I am hopelessly addicted to the virtual desktop paradigm offered by modern Unix window managers. I was so relieved when I found this product that I actually paid the $40 for it. http://www.codetek.com/php/virtual.php. Works great with Exposé.

An additional benefit to CodeTek's product is that it can optionally implement "focus-follows-mouse". This allows input to go to a window after the mouse enters it without needing to click inside first. Perhaps only useful for old-timey unix folks. Note that it is sometimes useful to use the preferences mechanism to request special treatment of certain applications. Especially useful is the check box for "this application ignores focus-follows-mouse". For instance, Quicksilver is really only useable when FFM is turned off for it.

There are at least two open-source virtual desktop apps out there: Space.app and Desktop Manager. I've used Desktop Manager, and I think there's real potential here to go with the open-source solution. However, I've been very impressed by CodeTek's quick response to technical issues, like interoperation with X11. Those with cash should perhaps just go to CodeTek; those wishing to economize, support open source projects, or get their hands a bit dirty might want to try Desktop Manager or Space.app first.




Launchers

Eventually, everyone seems to install an application launcher of some sort. These are little apps that help you to quickly launch some other application (or open some document, or open some url, ...) without having to use the Finder to navigate to that item. I have used LaunchBar and Quicksilver. There are others as well: I've heard of one called Butler, and if you search at http://www.macosxhints.com for "launcher", you'll find some excellent commentary on these apps.

I've settled on Quicksilver. It does exactly what I need, nothing more and nothing less. Command-space, then type a few letters and choose the app or doc out of the menu that pops up. For instance,

command-space  g  r
gives you Grab.app as the first choice. I never navigate to my Applications folder anymore. As far as less-is-more is concerned, let me just say that Quicksilver does one job extremely well, and leaves other jobs to other apps (e.g., there's no facility to assign a hot key to a some Applescript, as other launchers would allow).

In the Tiger era of Spotlight, one might think that Quicksilver is not necessary. I really suggest you download it and see how well it works, however. There is room both for very fast shallow searching, and for slower, more in-depth searching (i.e., Spotlight). I use command-space for Quicksilver, and have relegated Spotlight to shift-command-space. Add your Firefox or Safari bookmarks to the Quicksilver catalog (may require downloading a plugin for this purpose). It is much more convenient to do command-space O S" to quickly navigate to this page, for instance, than it is to hunt for "OS X for Ocean..." in your bookmark menu. You can also add specific directories to Quicksilver's catalog. I have a directory with all the PDF reprints of articles I've collected, named using a variant of the author-date system. To access the seminal 1960 paper on sequential estimation, "command-space k a l" presents me with kalman60a.pdf, which is then opened if I press enter. It's lightning fast.




Pathfinder and Finder tweaks

I've been toying with a Finder-on-steroids called Path Finder, available at http://www.cocoatech.com/. It does everything. Some people swear by it as a Finder replacement. I've found that I don't use the Finder enough to need something like PathFinder...but I expect some of you might.

In addition, there's a nice Applescript called "Open Terminal Here". This script can be dropped onto a Finder window and gives you a button that, well, opens-a-terminal-here, in the folder to which you've navigated. Very handy! Get it at http://www.entropy.ch/software/applescript/welcome.html.




Terminal Applications

A quick way to get focus-follows-mouse in Apple's Terminal.app:
defaults write com.apple.Terminal FocusFollowsMouse -string YES

iTerm is a very interesting alternative to Apple's Terminal.app. It's available at http://iterm.sourceforge.net. There may be other reasons to try it out, but the obvious advantage to iTerm is that it offers tabbed windows. Unfortunately, it has an outstandingly eccentric customization system. I frankly don't understand it, but with some care and an occasional blood sacrifice, I can get it to work. For instance:

I found that the default iTerm preferences had several limitations: the delete key would send control-D over ssh to emacs, the option key wouldn't send meta, etc. These were corrected after some experimentation in the Preferences > Profiles > Keyboard > vt100 panel. I added a mapping from "delete" to "backspace" (hexadecimal code 8), and selected option-sends-meta.

Note: As of September 2005, an annoying bug in persists in the latest iTerm (version 0.8.1). This bug makes the dock icon bounce almost continually (see http://sourceforge.net/forum/forum.php?thread_id=1263119&forum_id=230320). I recommend installing the older version, 0.8.0.

A very nice page on how to ease interactions between the Terminal and Finder is at http://www.chemistry.ucsc.edu/~wgscott/xtal/terminal_finder_interactions.html.

For reference, the fancy prompts in the above iTerm screenshot are due to the "set prompt" command in my .cshrc file (http://tazman.princeton.edu/osx/dot-cshrc). The first clause (enclosed in %{ and %} symbols) of this prompt string will set the title bar text of xterm, Terminal.app, and iTerm windows. For iTerms, it will also set the tab title:

set ellipsis
set prompt = '%{\e]0;%c3\007%}%S%D %w %T%s %U%m%u:%B%~%b%# ' 




Emacs

The emacs version distributed with OS X works only in a terminal window. The emacs and xemacs versions available from fink work only with terminals or X11 windows. If you're like me, and use emacs all the time, you'll benefit from a more native implementation. Not only does it look better, but it plays lots nicer with OS X. Most importantly to me, with a Carbon or Cocoa app there is a connection between emacs' cut-paste system (the kill ring etc.) and OS X's clipboard. Until recently, I had to say "There are several such native emacsen avilable, but they all have limitations and there's no one-size-fits-all solution as yet." Now I think I may have found the perfect native emacs (see below). Native implementations come in two flavors: Cocoa and Carbon. Cocoa is the application programming environment that was introduced with OS X. According to http://emacs-on-aqua.sourceforge.net/, "Carbon is the OS X legacy interface for MacOS 9 applications, but from a user perspective Carbon apps are indistinguishable from modern Cocoa apps."

I can't guarantee that I will keep this text up-to-date, so I recommend checking out some of these other web resources for emacs and OS X:

There's a new and rather pointless feature in the emacs splash screen: if you specify a file to edit on the command line, emacs will display its splash screen will the message "Press C-l to begin editing your file". If you'd like to avoid this annoying barrier to editing your file, you can start emacs with emacs -no-splash, which is a clear candidate for a csh alias.

Emacs keybindings for OS X and applications

Thankfully, OS X offers the ability to remap the standard text-editing keybindings across all Cocoa applications. This offers the ability to use emacs keybindings in programs that use OSX's text input routines. See instructions at http://beebo.org/mac/keybinding/ http://www.macosxhints.com/article.php?story=20060317045211408, or Google for "DefaultKeyBinding.dict". Firefox is, unfortunately, a special case--see the section on web browsing below.

MS Office emacsy keybindings




Web Browsing

While Safari is nice, Firefox is better. Get it at http://www.mozilla.org/products/firefox. In addition to the indispensable features of tabbed browsing and popup blocking, Firefox also has Adblock. This can be used to remove all the annoying, flashing ads from websites so that you (a) don't see them and (b) don't waste bandwidth downloading them. At the present time, Firefox is not integrated with Keychain.app, so passwords you use in Firefox won't be saved in Keychain. (This is likely to be fixed in the future--see http://wiki.mozilla.org/Firefox:2.0_Password_Manager.)

I strongly recommend getting the Schubert IT plugin for viewing PDFs in Safari and Firefox. While Preview.app and Acrobat Reader will do the same job, and frankly, do it better, many times I find myself needing a quick view of a PDF on the web. This is the way to do it! Get it at http://www.schubert-it.com/pluginpdf/. Schubert IT also makes a Word-view plugin for Safari, but I haven't tried it out. Works equally well in Firefox as in Safari.

Emacs keybindings in Firefox

Strange, but true! Not only does Firefox not pick up the system-wide Cocoa keybindings, but 99% of the instructions on the web are outdated because the Firefox people recently changed the way things are done. Starting with Firefox 1.0.5, there is no "/Applications/Firefox.app/Contents/MacOS/builtin" directory, so sites telling you to put a platformHTMLBindings.xml file there are errant. As of September 2005, the following ludicrous manipulations are required:
  1. Download the platformHTMLBindings.xml file into ~/Desktop.
  2. cd /Applications/Firefox.app/Contents/MacOS/chrome
  3. cp toolkit.jar toolkit.jar.orig (i.e., create a backup copy for safety)
  4. unzip toolkit.jar
  5. cp ~/Desktop/platformHTMLBindings.xml content/global/platformHTMLBindings.xml
  6. jar 0cvf toolkit.jar content (it's a zero, but you're copying/pasting this, right?)
  7. Restart Firefox
This tip from http://forums.mozillazine.org/viewtopic.php?t=292404&highlight=keybindings, with platformHTMLBindings.xml from http://www.puddingbowl.org/archive/2005/01/fix_firefox_key.php. (Warning: the latter is one of the web sites offering obsolete instructions, even though the actual xml file is still good.)




Octave

Works. Get it from Fink. Requires an X server for gnuplot graphics.

This is a GNU workalike for Matlab. In my humble opinion, Matlab should stick to numerics and stop trying to be a Swiss army knife--the creation of publication-quality graphics in Matlab is too interactive and too annoying. Octave does the numerics just as well, if not better. Octave's graphics are primitive, but effective. I have found it extremely useful to output plots as .fig files, then use the clunky-looking but very powerful xfig (also available at fink, more info at http://www.xfig.org) to edit and annotate for publication. Toolbox extensions are much better in Matlab than octave, however. Also see the "matcompat" Matlab compatibility page (http://users.powernet.co.uk/kienzle/octave/matcompat/).




Works great. Get it from Fink. Requires an X server for graphics. This is a freeware implementation of the S language specification. In my opinion it is as good a product as Splus, and due to its open nature is much more flexible. See the R project homepage. You will also find a native OS X port of R at the project homepage. I personally haven't tried it, but I know users who have both the fink-X11 version and the native (used to be called RAqua) version installed, and boy is there potential for confusion there! I recommend that you keep only one of these apps installed at a time, or you'll quickly lose track of which one has which extra packages installed, etc. The native version is less mature than the fink-x11 one, so I wouldn't expect the same level of stability. It all depends on how much GUIness you need.




Ken Bowman writes:

Dear Andy,

You might want to add a section on IDL to your Mac OS X page.

I have an IDL web site

http://idl.tamu.edu/

that includes Mac-specific tips

http://idl.tamu.edu/Resources.html

Cheers, Ken Bowman




   DataTank

Dennis Kahlbaum has provided the following description of DataTank, a commercial graphics and analysis package for OSX:
DataTank is an extensive and extendable tool for visualizing and manipulating scientific data sets. Written from scratch for Mac OS X, it allows interactive manipulation of 2D and 3D data sets with extensive support for time series and animation. DataTank can be used for a variety of fields such as Image processing, CFD, etc. DataTank can handle multi-GB data sets as well as data that is typed in by hand or given by analytic expressions. DataTank has extensive input/output capability in addition with 2D and 3D imaging and create publication quality plots as well as high quality anti-aliased graphics for web and presentations.

DataTank was the winner of the 2005 Apple Design Award for Scientific Computing Solution.

Please check out the Screen Shots tab. The GIS example (4th one down, USA map) is mine. It would be a good one to include on your web site as meteorologists and oceanographers frequently use contouring.

DataTank can be evaluated at http://www.visualdatatools.com/



   GMT

If you want to make maps, you can do so simply and quickly in Ferret, Matlab, or R. They each offer map projections, great color scales, and the ability to read common data formats. However, they make various unfortunate compromises:

For a long while I'd been aware of the Generic Mapping Tools (GMT, http://gmt.soest.hawaii.edu/. You might be familiar with GMT via its signature black and white block axes (e.g., this example). I'd avoided it for two reasons, both of which turned out to be misconceptions: I was leery of climbing yet another learning curve just to learn of annoying and unavoidable limitations, and I had gotten the impression that GMT didn't play well with netCDF files.

GMT offers flexibility which is nearly unlimited.

Its model is elegant; you use a series of command-line tools to create and append to a postscript output file. To make a long story short, this fine-grained approach means that limitations are basically nonexistent. There's always a way to get to your solution...it's just a question of how hard you want to work to make it happen. So far for me, this hasn't gone any further than using R to read in ferret color palettes and writing out a complex color palette table for GMT...and that wasn't difficult at all. While you might invest time in puzzling out a solution, the lesson learned is often worth the expense.

GMT works well with netCDF files.

My confusion stems from the fact that they've always called them "grid" (or .grd) files. This nomenclature remains in the documentation. GMT does expect that you intend to plot the first two-dimensional variable it finds in a netCDF file, but there's some syntax to specify different variables and to subset by dimension. I find that the netCDF operators are an excellent counterpart to GMT in that they can be used in a shell script to pre-process the data you want to eventually plot.

EXAMPLE

The figure below was made from freely-available CarbonTracker output (see http://carbontracker.noaa.gov), using GMT, Ferret, R, and NCO. I've put the shell scripts and output files in http://tazman.princeton.edu/osx/gmt in case anyone wants to see some semi-reusable code and examples.

The panel on the left is terrestrial NEE for July, 2005; the panel on the right is fossil fuel emissions for the same period.



   Ferret

Beta release available now! Full instructions available on the ferret page.


   Ocean Data View (ODV)

ODV is available for OS X from http://www.awi-bremerhaven.de/GEO/ODV/. Thanks to Will Howard for bringing this application to my attention!




Instructions available on a separate vis5d page.




   ImageMagick

Important. Get this from fink. It does all sorts of graphics conversions. For instance, you can make an mpeg animation from a series of png outputs by typing
convert gv05*.png gv05.mpg
This is how the GLOBALVIEW-CO2 animation shown on the right was made (click thumbnail for full 1979-2004 movie).

Full documentation is available on the web at http://www.imagemagick.org/.





Gimp

Very cool. Photoshop-quality image editor. Get it from fink. It is a world unto itself--see http://www.gimp.org.


LaTeX

teTeX is available from fink. dvips and gv work as usual.

I use LaTeX to typeset mathematical equations for my presentations, and it works great! Just do a dvi2pdf (or dvi2ps followed by ps2pdf), then fire up Acrobat Reader to display the document. Magnify it to the appropriate size, then use "grab" to select the area of interest. Grab will only allow you to save the result as a tiff file, but you can then use "preview" to export the result as a png. Then just include it in your powerpoint file, presto!

Also of interest is Equation Service, available at http://www.esm.psu.edu/mac-tex/EquationService/. This is a system tool that allows you to type in LaTeX equations and it will run tex to format the output for you. The results can then be converted on the fly to various graphical formats and inserted in documents quite easily. Note that if you install teTeX from fink, you have met the prerequisite of having a working pdflatex binary mentioned on the ES website.

Dan Vimont introduced me to a similar program, called Equation Editor (http://evolve.lse.ac.uk/software/EquationEditor/). It appears to have the same basic functionality as Equation Service, but with a completely different concept of the user interface. As with ES, you need a working TeX environment first. I'd appreciate any comments from users of these two programs to help understand how they differ.

Rant I've tried writing in MS Word and couldn't believe how frustrating it is. It's ridiculous that it crashes, ever--but it does crash and I've been the victim of lost text. When this happened to me, in 2004, I was shocked that I had made the famous rookie mistake of not saving the file every 2-5 minutes. Upon reflection, I realized that I had been working on various Unix platforms for the previous decade, and in that time had never lost my work due to an application or operating system crash. (Please don't ask about hard drive crashes, it still hurts to think about it.) Continuing my laundry list of complaints: Word uses 20-50% of my CPU when idle. There are both systematic and apparently random incompatibilities between different implementations, especially Windows-Mac, which hamper the sharing of documents. I think it's tremendously inefficient to be reaching for the mouse all to time for the most trivial of operations. Inclusion of scalable graphics in EPS or PS format is made intentionally difficult. Document sizes are ludicrously long. Word documents include all kinds of information that you don't know about, and may not want to share with the world, including material that has been ostensibly deleted from the file. Bibliography management is like pulling teeth with EndNote and Word (see EndNote section below). The composition of equations is tedious and painful, and the results are just plain ugly. Finally, if you believe as I do that competition is healthy in the world of software development, then reinforcing the existing monopoly is antithetical to progress.

There are times when it makes sense to use Word. Collaborative writing is a good example. But in these days, documents in PDF format are a superb means of sharing your writing, especially if all you want back is comments. Documents in LaTeX and in PDF are perfectly portable by design, and can be operated upon by a diversity of software tools, on a diversity of platforms. The management of bibliographic information is absolutely first-rate. The downside to LaTeX is the steep learning curve when you want to do something non-standard. Also tables require way too much fiddling and are difficult to visualize as you're typing them up. There are some interesting ways around the complex-table problem though:

Tips and Tricks What experienced LaTeX user hasn't developed a repertoire of tricks? Here's a quick sample showing some of my LaTeX and BibTeX tricks, customized for AGU-ish journals: http://tazman.princeton.edu/osx/texsample.pdf. The tex source is at http://tazman.princeton.edu/osx/texsample.tex. Things of interest include the use of macros such as \iso to quickly typeset 13C. Note also the use of interesting in-text citations: \citep, \citet, and \citeauthor, all of which are enabled by loading the natbib package. If you want to compile this file, you'll need http://tazman.princeton.edu/osx/bxp_so.eps, http://tazman.princeton.edu/osx/endfloat.cfg, and http://tazman.princeton.edu/osx/arj.bib.

To compile it into PDF do:

latex texsample
bibtex texsample
latex texsample
dvips texsample.dvi -o texsample.ps
ps2pdf texsample.ps

You of course will need a working LaTeX distribution before doing this, and you may find that you need to download some packages from http://www.ctan.org as well. Note also the discussion of EndNote below, especially comments on interoperability with BibTeX.

AUCTeX

Wow, how did I ever live without this? This is an advanced package for working with TeX documents within Emacs. What I like most about it is the fact that you can run latex, bibtex, and gv -watch all from within emacs. No need to leave the comfortable surroundings of your favorite editor. I made two customizations. (1) I added to the list of available external commands that AUCTeX can run, including making up a new command that does (latex,bibtex,latex,dvips) and (2) I bound this to the F6 key. To add to the list of available commands that AUCTeX can perform, do a M-x customize-group TeX-command. Navigate to "TeX command list" and INSert whatever you want. The tail end of my TeX-command-list looks like this:
INS DEL Name: ps2pdf
            Command: ps2pdf %s.ps
            How: Value Menu TeX-run-command
            Prompt: Toggle  off (nil)
            Modes: Value Menu All
            Menu elements:
            INS
INS DEL Name: open
            Command: open %s.pdf
            How: Value Menu TeX-run-command
            Prompt: Toggle  off (nil)
            Modes: Value Menu All
            Menu elements:
            INS
INS DEL Name: gv
            Command: gv -watch %s.ps
            How: Value Menu TeX-run-background
            Prompt: Toggle  off (nil)
            Modes: Value Menu All
            Menu elements:
            INS
INS DEL Name: andy
            Command: %l "%(mode)\input{%t}"; bibtex %s; %l "%(mode)\input{%t}";%l "%(mode)\input{%t}";dvips %s.dvi -o %s.ps
            How: Value Menu TeX-run-TeX
            Prompt: Toggle  off (nil)
            Modes: Value Menu Set:
            [ ] Plain TeX
            [X] LaTeX
            [ ] DocTeX
            [ ] ConTeXt
            [ ] Texinfo
            [ ] AmSTeX
            Menu elements:
The last item above, imaginatively named "andy", is the workhorse. It does a latex-bibtex-latex-dvips sequence on the file. My normal workflow is to call up the document in emacs, do a C-C C-c gv to call up ghostview with the -watch option, make some edits, then when I want to see the updated output, I hit F6. (Note that more recent "gv" versions require a double dash for options, so gv --watch is the magic.) Some extra glue was needed to make this keybinding happen, and that glue exists in my .emacs file. I wrote a simple function called auctex-latex-and-dvips which saves the current file, then invokes AUCTeX to compile the file into postscript using the customized TeX-command called "andy" discussed above. This function is then bound to the F6 key via a hook that gets executed whenever a .tex file is read in:
;; auctex stuff
(require 'tex-site)

(defun auctex-latex-and-dvips ()
  (interactive)
  (save-some-buffers t)
  (TeX-command "andy" 'TeX-master-file))

(add-hook 'LaTeX-mode-hook
          (lambda ()
            (define-key LaTeX-mode-map [f6] 'auctex-latex-and-dvips)
))



NCAR Graphics

From Niki Gruber:
One package that I am using quite frequently is NCAR Graphics and the associated scripting language NCL. Once one has the proper X-server installed, it appears to be no problem to install and run it.
Fink has a package for NCAR graphics by the name of "ncarg". The ncarg package maintainer, Jeff Whitaker, tells me that NCL is not available for OS X because it is only distributed in binary format. N.B. I had to do a "fink selfupdate-cvs" before installing this package (on 22 Jan 03); I think this means that some rather recent change to the fink system itself is needed in order to install this code. I parse "selfupdate-cvs" to mean that fink source code is to be checked out of CVS and compiled locally. Why ncarg would need updated fink software is a mystery to me.

UPDATE 5 April 2003: Jan Dutton informs me that NCL has been released for OS X. See http://ngwww.ucar.edu/ncl/download.html. As of this writing, Jeff Whitaker appears to have put this in fink's current-unstable branch, so you can get it from fink, also.



GrADS

The Grid Analysis and Display System (GrADS) is available from fink. Homepage is http://grads.iges.org/grads/grads.html.


DODS/OpenNDAP

OpenNDAP client libraries (formerly known as DODS) are available from fink.


Masashi Ito asks:

On the screenshots at your website, I saw a nice panel on the lefthand side of the screen which shows date, time, CPU usage and so on. What is the software's name? From where can I get it??

It's called "gkrellm" (http://www.gkrellm.net). You get it from fink with, e.g., apt-get install gkrellm. It requires X11. I like it to appear on every virtual desktop (see CodeTek above), which can be done with by putting the mouse in the gkrellm window, then hitting option-escape. This brings up a CodeTek menu from which "Make Window Sticky" can be selected.





MATLAB

Just give me the &%^#* prompt!

alias matlab '/Applications/MATLAB704/bin/matlab -nojvm -nosplash'

Installation

I just installed Matlab 7.04 on Tiger and experienced no troubles whatsoever (except 5 emails back and forth with three people involved over three days to get a workable licence.dat file--curse you, MathWorks, for the FlexLM abomination!). However, Manuel Gloor once told me (I think this is all out-of-date now, especially since we should all be using Apple's X11, but is included just in case):

Hi Andy,

as it took my a while to figure these things out it might be of interest to others that will use MacOSx in the future so I thought to send them to you - you may possibly add them to your webpage.

Installing Matlab 6.5 is not completely straightforward. The installation worked when I did two things:

(1) install a recent version of XDarwin (version 4.3) - see http://www.xdarwin.org/download and instructions there

This XDarwin version permits to run the MacOSX surface in parallel with XDarwin (apparently called rootless mode)

(After sending an email to the XDarwin developers the ftp site for download is sent via email within a minute - the site that I used was

ftp://ftp.xfree86.org/pub/XFree86/4.3.0/binaries/Darwin-ppc-6.x

(2) The disks as is provided by Matlab will not install properly. However when downloading the MathWorks_Jaguar_Updater from http://www.ldeo.columbia.edu/ldeo/it/Software/matlab/33053.html and using it to do the installation Matlab installed correctly.

The computer where I made the installations is a Power Book G4 with operating system MacOSX 10.2.8

Addendum: although I haven't checked this, I would assume that if you already have a working X11 installation, you don't need to download and install a new XDarwin release. One could try starting from step (2) above.


EndNote

EndNote FAQs, news flashes, bulletins, etc. can be found at http://www.endnote.com/support/ensupport.asp. This is the first place to look when encountering difficulties. There are, for instance, some interesting comments about oddities when using EndNote (6, 7, or 8) with OS X 10.4 (Tiger). The archives for the "EndNote interest" mailing list can be found at http://lists.adeptscience.co.uk/endnote/.

I mainly discuss EndNote7 below. Scroll to the end of this section for material on EndNote8.

DOIs

It is possible to use DOIs in EndNote 7. Unfortunately, DOIs are not exported from Web of Science. I am also unsure how portable they will be to EN8. However, they can be printed out in the formatted bibliography, and that's what really is needed. See http://ajzz.org/article.php?story=20040812153009671&mode=print for instructions. Basically, this involves defining a new field for the EndNote database.

Note that DOIs can be added to the BibTeX export format by choosing Edit > Output Styles > BibTex Export. Then navigate to Bibliography > Templates. Scroll down to Journal Article and make it look like this:

@article{
Label,
   `Author = {`Author`},`
   `Title = {`Title`},`
   `Journal = {`Journal`},`
   `Volume = {`Volume`},`
   `Number = {`Issue`},`
   `Pages = {`Pages`},`
   `DOI = {`DOI`},`
   `Note = {`Notes`},`
   `Abstract = {`Abstract`},`
   `Keywords = {`Keywords`},`
   `Year = {`Year`} }` 
The DOI field is of course the new information, and the above syntax assumes that you've already added the field called "DOI" to your EndNote database.

I've come to the conclusion that EN7 is a workable and superior means of storing my bibliographic material, even though I use BibTeX to manage references in my writing. If you've used BibTeX, you are familiar with the concept of the citation key--it is the short string at the beginning of a BibTeX database entry that uniquely identifies the reference and is used in the citation command. For instance, I use a simple scheme: author's last name, followed by 2-digit year of publication, and finally a letter (a-z) having no real meaning other than the order in which I encountered the paper, but serving to make sure the citation key is unique. For instance, in the excerpt that follows, the citation keys are sarmiento93a and sarmiento93b.

@article{
sarmiento93a,
   Author = {Sarmiento, J.  {L}. and Slater, R.  {D}. and Fasham, M.  {J}.  {R}. and Ducklow, H.  {W}. and Toggweiler, J.  {R}. and Evans, G.  {T}.},
   Title = {A seasonal three-dimensional ecosystem model of nitrogen cycling in the North {Atlantic} euphotic zone},
   Journal = {Global Biogeochemical Cycles},
   Volume = {7},
   Number = {2},
   Pages = {417--450},
 Year = {1993} }

@article{
sarmiento93b,
   Author = {Sarmiento, J.  {L}.},
   Title = {Carbon-Cycle - Atmospheric {{CO}}$_2$ Stalled},
   Journal = {Nature},
   Volume = {365},
   Number = {6448},
   Pages = {697-698},
 Year = {1993} } 
EN7's BibTeX output puts the contents of its "label" field in the citation key position. Thus a reasonable decision for getting these two programs to work together is to store the citation keys in the EN7 label field. Note also that the in-text citations format for EN7 when using MS Word allow you to use any field to identify the reference. Thus you can use your BibTeX citation keys with Word/EN7. Just type, for instance, {sarmiento93a in Word, and see whether EN7 can format the bibliography.

EN7 is clunky but mostly stable. It is not very native to OS X--it ignores the Carbon input methods that I use to install system-wide emacs keybindings, for instance--but it Just Works. Every change I make is automatically (and instantly, apparently) written to disk. The "killer application" is bibliographic input: getting the data into your personal system. I now do this mostly via Web of Science, but third parties (like the Princeton University library) make their main catalog searches exportable into EN format. Note that the internal "connections" tools to access Web of Science directly from EN7 are completely broken (but also not necessary). The best thing to do is access Web of Science via the web, mark your references, go to the "Marked Reference" list, and choose "export to reference software". If using Firefox, this will automatically switch you to EN7 and load up the new citations; if using Safari I think you need to switch to EN7 yourself and open the downloaded file.

Bibliography conversion service

I haven't tried this, but it looks promising: an online bibliographic conversion service sponsored by the Swiss Federal Institute of Technology (ETH) as part of the ShaRef project (http://dret.net/projects/sharef/). You can upload BibTeX or Endnote (7, 8, or 9) files to the Bibconvert service at http://dret.net/bibconvert/, and it will convert the references to any of the other formats.

Output to BibTeX

Importantly, EN allows export to open formats, the most important of which are BibTeX and "refer". Unfortunately, while EN7 can accept and store accented characters, BibTeX cannot understand the output. I've written a perl filter to restore common accents, chemical symbols, and capitalizations. It has some general-purpose content, and some specific content that may not work for you. Comments on improving it would be welcome.: http://tazman.princeton.edu/en2bib.pl. To use it, export your library from EndNote using the BibTeX output style. Let's say you call this en.bib. Then you run it through this script as

perl en2bib.pl <en.bib >arj.bib

Input from BibTeX

For information on using EndNote and Bibtex together, see the list of sites at http://www.library.auckland.ac.nz/endnote/latex.htm, or jump directly to the most useful one, http://www.cvrti.utah.edu/~macleod/litbase/endnote.html. In short, however, to import a bibtex file into EndNote, it has to be converted to Refer format. One way to do this is to use the refer.bst style file (here with a Bibtex file called "consolidated.bib"):

\documentclass[12pt]{article}
\begin{document}
\nocite{*}
\bibliographystyle{refer}
\bibliography{consolidated}

Hacking on an EndNote Library

I've written up a sample script showing how one can use awk (standard unixy tool available on OSX) to do arbitrary processing on EndNote libraries exported to tab-delimited format. There are some necessary pre-processing steps, so if you're interested I strongly recommend that you read the extensive comments within the script. Without further ado, add_labels.awk.

EndNote8

EndNote8 requires Word 2004, and vice versa. If you upgrade to one, you must upgrade the other.

Will Howard reports on the use of EndNote 8 and DOIs:

One problem with the older versions of Endnote is that there was not provision for Digital Object Identifier (DOI), and more and more journals are using it. I have amended a style file (attached) for JGR that displays DOI in the bibliography. This style of course covers AGU pubs, such as GRL, Paleoceanography, Global Biogeochemical Cycles, and other journals we earth/atmosphere/ice/ocean scientists contribute to commonly.

What really has to happen next I suppose is for styles representative of journals from other publishers to be amended, e.g. Elsevier, Pergamon, etc. When you think about it we really only tend to submit to a relatively small number of journals from a subset of publishers.

If you've been substituting some other field for DOI (I used "Label"), and you then import your older-than-ver8 database into Version 8, you do have to swap whatever field you've been using for DOI into the "electronic resource number" field. Luckily this is fairly straightforward:

Under "References" menu, go to "Move and Change Fields" -> "Move Fields" Then move fields. In my case I exchanged "Label," which I had been using to hold DOI, for "Electronic Resource Number."

I do recommend for anyone switching over to keep the old Endnote 7 application and libraries in a separate directory for a while, until they're sure Endnote 8 works reliably. Especially because Endnote 8 databases can't be converted back to earlier versions' formats.

Will's JGR style file is at http://tazman.princeton.edu/osx/J Geophysical Res.ens.



Miscellaneous

Don't use Dashboard?

No particular reason to leave it running, consuming memory. Following http://www.macosxhints.com/article.php?story=20050723123302403, you can turn Dashboard off by doing:
defaults write com.apple.dashboard mcx-disabled -boolean YES
killall Dock

Unsurprisingly, you change YES to NO to re-enable Dashboard:

defaults write com.apple.dashboard mcx-disabled -boolean NO
killall Dock



Andy Jacobson webmaster@tazman.princeton.edu