OS X Leopard for Physicists

30Jun08

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.

OS X Leopard Desktop

Why Apple?

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.)

Initial Tweaks

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.

Quicksilver

(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:

http://www.slac.stanford.edu/spires/find/hep/www?rawcmd=find+***

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.

Physics-y programs

I’m told that ROOT and GNUplot install just fine. An OS X version of TopDraw is available via Stephen Park.

For HEP computing, you can check out HPC on OS X. Note that you can acquire gfortran in package form. I found that for my meager needs (for now at least) I didn’t require anything fancy.

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 F77=f77 to F77=g77.

Other Programs

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.


15 Responses to “OS X Leopard for Physicists”

  1. 1 Chris

    Nice guide!

    I’m a big fan of Papers for a PDF manager. There’s a 40% discount for students too. http://mekentosj.com/papers/

  2. 2 asoo

    My adviser recently offered to buy me a laptop, and after getting annoyed with linux (which I have been using for about 6 yrs), I thought may be Apple is onto something with all this hype about simplicity. So I got a MacbookPro. However, I’ve been quite underwhelmed. Some things that annoy me in Mac are:

    1) Too few buttons in keyboard. I especially miss the right Crtl key which is essential in navigating an Emacs buffer.
    2) Lack of softwares. All linux distros come with essential softwares already installed. There are cool programs like Tomboy and qalculate, I haven’t found alternatives for in Mac.
    3)If a program you want is not installed, in ubuntu it was very easy to install it. Just search for it in the package manager and hit install. In Mac, I have to go search for it and download it and then install it. Furthermore, this dmg, pkg, etc. is quite confusing.
    4) Things crash in OS X a lot. Safari, firefox, quicktime, vlc, preview crash quite often if you don’t restart your system every few days. In Ubuntu, i’d go months without restarting and programs hardly ever crashed.
    5) Navigating windows of two different programs is difficult and time consuming. I usually have more than one window of iTerm and firefox running. To switch between windows, I usually have to pres Command-Tab and Command-`. Using expose is even more slower.

  3. 3 anon.

    OS X is not Linux under the hood, it’s BSD Unix on top of some microkernel. Linux is just one of many Unices.

  4. 4 T66

    @asoo
    -> 2: Do yourself a favor and download Sun’s VirtualBox. Install your own Linux and run whatever cool program you want.
    -> 4: If you need to restart the system every few days something’s seriously wrong. The only restarts I do is when the occasional Mac OS update needs it. I suggest you take your MacBook Pro to a Mac Store and have a genius look at it.
    -> 5: check out Many Tricks excellent Witch utility. It’s at http://www.manytricks.com/witch/ It’ll do wonders with fast windows navigation.

  5. @asoo: DarwinPorts and fink are 2 programs that provide easy installation of many packages like you’d find in most Linux distros.

  6. 6 Dave

    asso, If your system is crashing alot then you’ve probably clobbered something. Buy lunch for a geek Mac using friend and ask him for some guidance. He will probably do a fresh archive install and get you back to a solid system in a couple of hours. Bring it up to 10.5.4 which is rock solid on a dozen systems that I manage.

    You just need to get past the newness and the differences in OS X. It works well when you let it. Your reaction is the same as many Windows users in their first month after a switch. In a few months you’ll be in control once again.

  7. 7 Wayne

    INAPB (I’m Not a Physicist, But) your readers might find a couple of free programs useful:

    * R for statistics and graphing (http://www.r-project.org/).

    * LyX if they’ve somehow managed to not master LaTeX syntax by now.

    * Macports, for an easy way to get Open Source software (http://www.macports.org/).

  8. 8 Ken Sherman

    A lot of new users to the Mac close the last window of an application and don’t realize the app is still running. Look under the icons on your dock and see if there is a white dot under them. You may be using up a lot of memory and not realizing it. Make sure you quit your apps when you’re done using them. This will help performance and it will help stability a little bit. You also have a hardware issue such as a bad memory module.
    You can also remap the keys on your keyboard if you wish. This might help with emacs. If you install Fink or Macports and X11 most Linux apps are as easy to install as on Linux.
    Be patient and the Mac OS will grow on you. No, it is not perfect, but it’s a very nice place to work. 😉

    Ken

  9. 9 Viswakarma

    It would be nice Switchers from Linux or Microsoft Windows environments to Apple Mac OS X understand that the Macintosh (in all its incarnations) uses a window per document and contextually changing menu bar for controlling the application that handles the active document. This very subtle difference confuses the switchers from Linux/Windows to Mac OS X.

  10. 10 veggiedude

    Take a look inside the Applications folder and then locate the Utilities folder. Inside of that is a really neat program called Grapher.

    With Grapher you can model complex mathematical equations.

    Maybe it’s not as useful to physicists, but it sure is a fun way to look at maths.

  11. I just wanted to second Chris’s recommendation of Papers. It interacts quite nicely with the arxiv to gather metadata about a paper and also exports to bibtex. Worth investigating…
    Thanks for the tips!

  12. 12 Big Vlad

    I’m another physicist who recently got a macbook, and I couldn’t be happier with it. It’s fast and never crashes. All the physics apps I use on the department computers are easily installed with fink. Basically one has the best of both worlds: a machine which provides the linux-like working environment, but also has non-linux like easy wireless and multimedia stuff.

  13. eliminate the Mac startup sound – once and for all!

    http://www.macosxhints.com/article.php?story=20031005165919533

  14. 14 teenoie

    Website about types of software Operating Software,Utilities Software Download, games download, music. download, Antivirus, antispyware, malware,movie download,knowledge about Network, and basic computer troubleshooting.


  1. 1 dual boot drive