OS X Leopard for Physicists
I’ve recently purchased a new MacBook and thought I’d share some set-up information. I borrow heavily from Professor Murayama’s OS X for Physicists, but have tried to focus on tidbits that have either been updated or aren’t covered there.
Most physicists will have already noticed the rapid adoption of Apple technology in academia. One of the main reasons for this is that OS X runs Linux Unix under the hood. This means you can (usually) run all of your favorite Linux-based physics applications while also having the luxury of a commercially-supported multimedia system. (Think about that the next time you try to play one of TASI’s wmv files in Linux…)
In general, I’ve been rather impressed with Apple’s build quality. Wireless networking and battery life seem to be a notch better than similar PC systems, and even things like ‘right click’ can be implemented painlessly (see below).
A note and a caveat
One note: consider the AppleCare 3-year warranty as a required purchase. Apple’s build quality is very good, but this doesn’t make them immune for the occasional gaffes. You’ll want to be able to take advantage of their top-notch customer service. Also, AppleCare is attached to a computer serial number, so that if you sell your machine, the remaining warranty transfers automatically, bolstering a machine’s resale value.
One caveat: OS X, unfortunately, isn’t perfect. Users coming from a Linux background won’t be terribly impressed by Leopard’s eye-candy. Most of the functional features have either been borrowed from Linux distributions or have already been copied by them. Start up times, while much better than Windows, are still slower than Linux. Finally, the support community isn’t as large or eager as Ubuntu’s and it’s not as easy to find non-standard packages. (If these are issues, one can dual boot using the BootCamp utility.)
Upon plugging in and turning on your machine, OS X will guide you through a quick set up and registration. If you’re on a MacBook (Pro), the first thing you’ll want to do is tweak the trackpad configuration to allow right-clicks. Go to System Preferences (it’s on your Dock) and click on “Keyboard & Mouse.” Here are my settings:
This allows me to click by tapping the track pad, and right-click by tapping with two fingers. Presto, no more issues with Apple only having one mouse button.
If you’re on a small laptop screen, you might also want to configure Apple Spaces. I also suggest using “active screen corners” in Expose to make it easier to swap between windows on cluttered screens (command-tab works too). Finally, you might want to set the dock to hide automatically especially if you’re using Quicksilver (see below).
“Fired up, ready to go”
Perhaps the biggest “OS X for Physicists” update with Leopard (the 10.5 version of OS X) is that more things are ready-to-go out of the box. You will already have X11 pre-installed, but if not you can install it easily by following the instructions from the OS X disc #1 that came with you system. Update: Actually, you’ll want the latest version of X11 from the XQuartz project. Just download and double-click the pkg file.
The next step is to install the Xcode Developers Tools. These are on the OS X disc #2 that came with your system. Double click “XcodeTools.mpkg” and install the whole thing. This will install, among other things, the gcc compiler which you’ll need to install all those *nix-based physics programs.
(Un)Installing Stuff: Native OS X and X11 Apps
Now is a good time to point out how to install “normal” OS X and X11 apps. Here’s a quick look at my “Downloads” folder after a day of OS X:
You’ve already met pkg packages which have their own installers. Most ‘normal’ programs, however, come in a handy dmg format, where the file mimics an external drive. Double clicking them prompts you to mount the drive, which then pops out an app file. Copy this file into your favorite folder (try the “applications” folder). Some programs will even make this step easier for you, for example:
In this image the X11 program Gimp is providing a nice splash screen that makes it really easy to move the app file into your Applications folder. (More on Gimp below.)
That’s it! You can unmount the dmg file and throw it in the trash. To uninstall such programs, just take the app file and move it to the trash. It’s that easy.
Fink: “apt-get” style package manager
You’ll also want to have a package manager to install Linux-based packages. You have two choices, Fink and MacPorts (formerly DarwinPorts). I decided to go with Fink, just because other physicists seem to use it. Fink has also very recently released a binary installer for OS X 10.5, so Leopard users don’t have to compile from source anymore. See Fink’s FAQ for usage. You can find the terminal application in /Application/Utilities.
LaTeX on OS X
Alright, so let’s move on to the big one. All this would be all for nought if we can’t get a good LaTeX distribution working. Fortunately, you’ve got MacTex to make this process absolutely painless. Just download the dmg and follow the instructions. By default, MacTex gives you the full TexLive 2007 distribution, which is currently the standard for Linux distributions like Ubuntu. Note that MacTex defaults to pdftex, taking advantage of OS X’s native support for the pdf format. Don’t worry, you still get the option to use the regular latex, dvips, and ps2pdf commands as well.
There are some bonuses, too. MacTex automatically installs TexShop, a nice bare-bones editor. There’s a handy “typeset” button which you can set to run pdftex, latex, or a personal script. Also installed are (outdated) versions of BibDesk and LaTeXiT, a bibliography organization tool and a LaTeX’ing program for exporting equations to other applications. In previous releases, users had to configure these programs manually.
Since Leopard, these programs are automatically configured with the correct LaTeX paths. Just in case, however, you should know that the TeX path is “/usr/texbin” and the ghostscript path is “/usr/local/bin”. How do you check? Just go into the terminal and type in “which latex” or “which dvips” to determine the path.
What about packages? In Linux/Windows, if you can’t find a package using your package manager, it’s nontrivial to get packages installed properly. With MacTex, all you have to do is drop the packages (e.g. sty files) into the folder “~/Library/texmf/“, where the tilde stands for home. For example, I have my axodraw packages in “~/Library/texmf/tex/latex/axodraw/”. (You can create subdirectories to keep things organized.)
Update: For Bibtex, the bst (Bibtex style) files must go into “~/Library/texmf/bibtex/bst” or subfolders of this directory. If you have universal bibliographies, you should put them into “~/Library/texmf/bibtex/bib”.
Now let’s put this all together.
For Feynman diagrams, I prefer using Jaxodraw. Luckily, there’s an OS X dmg available. In order for MacTex to correctly parse axodraw, you’ll need to download and insert pstricks.sty, axodraw.sty, and color.sty into your texmf tree. Unlike the other programs, you have to type in the LaTeX and dvips paths by hand:
(Thanks to Professor Siegel for his suggestions.)
Great! The last piece you really need, however, is a ‘heavy duty’ LaTeX development environment. TeXShop is cute and hits the spot for small projects, but for a multi-file thesis you’re going to need something with more oomph.
The natural choice is TexMaker, see the screenshot above. This should also be pre-configured to work with MacTex upon downloading, but just in case here are the typesetting settings for the default MacTex installation:
Linux users may already be familiar with TexMaker, but chances are you’re asking where to find a dmg for Kile. As many of you know, Kile’s autocompletion and customization features are unparalleled. Unfortunately… it’s not really available.
There are ongoing efforts to port KDE to OS X, but they’re not quite there yet. If you’re feeling bold, you can try these instructions for installing KDE and Kile natively. They are, however, rather involved and I’m not sure how to undo the steps if things don’t work out.
Update: I couldn’t stand using TexMaker. The development environment is too bulky and it’s so far from grace (Kile). Yearning for a program that’ll bring the joy back into TeX, I ended up puchasing an academic license for TextMate. It doesn’t have all the features that Kile does (e.g. smart tab-based completion), but it does come close and has several features that Kile doesn’t. It’s a heavy-duty editor for programming packaged in a deceptively simple interface. I suggest checking out the LaTeX-in-TextMate screencasts (at the bottom of that page) if you’re considering using TextMate as your primary TeX editor. Also check out this TextMate LaTeX extension bundle.
Another application to spice up your TeX life (see what I did there?) is the pdf viewer Skim.
Skim has a few neat features, such as the ability to scribble notes onto a pdf (saved as metadata) and the ability to integrate with LaTeX editors (i.e. going from a point in a pdf document to the corresponding point in the LaTeX code). I found that Skim was just a tiny bit slower than the regular previewer, so I decided not to use it as my default. I still find it very useful for reading and jotting notes on papers, though.
(Updated 2 July 08) It’s not strictly a HEP tool, but all the cool kids these days are using Quicksilver, which allows you to use intuitive hot-keys to launch programs. I’m told it’ll change the way you interact with your operating system, but for now I think it’s just a huge convenience. At the very least it makes you less reliant on the dock and finder.
One especially useful feature is to set up Quicksilver to search SPIRES without ever having to leave your keyboard. Go ahead and install the web search plug-in. This plug-in has changed a bit since the OS X 10.4 implementation, so it’ll make a good example. You can follow these instructions for any search engine, e.g. Google, Wikipedia, ArXiV, CERN video search.
After you’ve installed the web search plug-in, fire up your browser of choice and go to SPIRES (or whatever you’re searching). Search for *** and copy the resulting URL. For example, for SPIRES the URL is:
Three asterisks are a key for Quicksilver to ‘insert stuff here.’ Next, go to the Quicksilver’s Preferences and click on ‘Catalog’ on the top right. Then click on the ‘+’ on the bottom of the window and select ‘Web Search List.’ This will open up a new source under “Custom,” which you can click to edit. Insert the URL into the appropriate field of the slide-out window and give it a name.
Go to Quicksilver > Rescan Catalog to update with your changes. Now you can pull up Quicksilver (control+space), begin to type in “Spires” (or whatever you named it) and you should get the following options. Tab to type in your query and press enter to launch your default browser to the results. Easy-peasy.
I’m told that ROOT and GNUplot install just fine. An OS X version of TopDraw is available via Stephen Park.
You might find that you’ll have to link f77 to either gfortran or g77 (from the HPC link) using a shell command like
sudo ln -s /usr/local/bin/g77 /usr/local/bin/f77. This is the case, for example, with MadGraph. If you’re queasy about doing things that aren’t obvious to undo, then you can usually just go into the makefiles and change the line
Alright, let’s talk about other programs. Let me answer your first question: other than “Photo Booth,” the only game that ships with OS X is Chess. Other useful programs that ship with OS X are:
- Dashboard: Tae-Won Ha has a nice Spires widget.
- iChat: the new “iChat theater” makes it really useful for discussing … say, papers with your adviser when (s)he is away. (Want brownie points? Use a chalkboard for your video background.) Alternately, consider Adium, which allows you to share TeX over IM.
- Time Machine: Another Leopard feature that is rather important for thesis-writers. Unfortunately it really needs an investment in another hard drive, but consider it data-loss insurance.
- Grapher: Easy-to-use software for making a variety of 2D and 3D graphs. It’s not Mathematica, but it is a pretty neat toy. You can find it hidden in the Utilities folder.
You can find Mathematica, Microsoft Office, and Adobe Photoshop/Illustrator/etc. on OS X. For open source alternatives (or here, or here) of the graphics programs, you might consider Gimp and Inkscape. You might consider iWork instead of Office. My two cents: LaTeX over Pages/Word, Excel and Numbers are about the same, and Keynote is a nicer version of Powerpoint… but one that can be emulated in Beamer. [Update: I have found, however, that Keynote imports Powerpoint files surprisingly well. It’s not perfect, but if you have a Powerpoint presentation already made, you won’t have to redo the whole thing in Keynote.]
You can use Fink (or MacPorts) to grab emacs or vim. Alternately, there are various OS X-version available (e.g. Aquamacs). I used MacPorts to install gedit, but found it a bit slow to load. [Update: I ended up spending money and using TextMate, see above.]
(Update, 5 July 08) For non-Apple media, Flip4Mac offers free Windows Media components for Quick Time. For the rest, you can use Perian. Linux users will also be happy to know that VLC is available for OS X.
Odds and Ends
If you’re on an Apple laptop, you might want to calibrate your battery. This will prevent sudden shut-downs when you’re on low battery because your operating system misjudged how much gas was left in the tank. You can also download an application like Coconut Battery to keep up with your battery health. In the past Apple had some kinks to work out with its batteries, though these seem to be a non-issue these days. By the way, to prevent battery over-charging, Apple laptops do not charge when the battery is at 95% or higher when plugged in. So don’t worry if your batteries don’t ‘top off.’ (If you run the battery down to 94%, it’ll charge back up to 100% when plugged in.) You can read up more on batteries if you’re interested.
Another issue that Apple had with its MacBooks involved case cracking from normal use. This also appears to have been fixed, and rumors of upcoming aluminum MacBooks will certainly put the issue to rest. However, to be on the safe side I got a screen protector/cleaner that’s essentially a chamois that goes over the keyboard when closing the laptop.
Links (very useful)
- Mac OS X for Physicists, by Professor Murayama. A great guide for getting set up, this was my main reference.
- MacResearch, a great community for asking questions.
- Mac OS X, by Professor Siegel. A nice collection of tips and updates for hep-th/ph OS X users.
- High Performance Computing on OS X. Info about installing compilers and other fancy tools that I’m no expert on.
- MacRumors and AppleInsider. Where all the Apple fanatics go. Even if you don’t care much about the latest products, the forums at these sites are incredibly helpful for technical support and advice.
Filed under: Opinion, Physics, Science 2.0, Student Life | 15 Comments