Scientific Programming on a Mac

Emacs

I use Gnu Emacs For Mac as Carbon Emacs is no longer updated.

To run the Emacs server at login, create a file called ~/Library/LaunchAgents/com.emacs.server.daemon.plist and set its contents to:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>Label</key>
        <string>com.emacs.server.daemon.plist</string>

        <key>ProgramArguments</key>
        <array>
                <string>/Applications/Emacs.app/Contents/MacOS/Emacs</string>
                <string>--daemon</string>
        </array>

        <key>RunAtLoad</key>
        <true/>

        <key>StandardErrorPath</key>
        <string>/dev/null</string>

        <key>StandardOutPath</key>
        <string>/dev/null</string>

        <key>Nice</key>
        <integer>-1</integer>

       <key>ServiceDescription</key>
       <string>Emacs Sever Daemon</string>
</dict>
</plist>

Now, every time you login, the Emacs server will start. To invoke emacs (using the emacsclient), place the following alias in your .bashrc file:

alias emacs="/Applications/Emacs.app/Contents/MacOS/bin/emacsclient -nc $@"

Update your Org version (if you use it) as the one that comes with XCode is quite old

My .emacs file is a combination of Ryan McGeary's (github) and Ryan McGuire's (github)

You can easily customize your color theme using Alex Pogosian's color theme creator

Terminal

I used this modification to my .bashrc file to allow me to type in part of a command and then press the up/down arrow to search through the history for commands beginning with that part (as in the Matlab command line)

Scripts

Useful script to open a terminal at this finder location here. I prefer this to the setting in System Preferences as you can simply have Finder opened to a certain folder (as opposed to having to highlight a folder)

The above is invoked with FastScripts

My .bashrc file is also a derivative of Ryan McGeary's, which you can find from his github account…he's got some good stuff!

Package Manager

Homebrew provides simple downloads of open source software that isn't included in XCode (e.g., gfortran). It's easy and, generally speaking, doesn't duplicate downloads you already have from elsewhere (i.e., you won't have multiple gcc versions floating around)

Other Useful Programs

Git

Use GitX if you need a simple, light-weight Git GUI and are comfortable using git from the command line

Use SourceTree if you want a nice, yet powerful Git GUI that gives you access to Git features in a point and click fashion

Software I still want to try

Software distribution on a Mac

PackageMaker does what it sets out to do but is poorly documented, leaving the user to feel around for himself. This is especially true of its command line options, which become fairly important if you intend to automate the package-making process. After a bit of searching, I found several very useful links that make using PackageMaker far less inscrutable, though it's still not quite a pleasure :) Now, it would be wonderful if you could actually set GUI values from the command line (eg title, license, background image). Or, if that's already possible, I'd love to know how to do it :)

Very useful guidance for automating the creation of a .dmg file I didn't end up going with this, but it's quite useful

In general, the software and tutorials on this page are quite good Specifically, the program Packages seems like a good replacement for PackageMaker and the documentation is more straightforward

Scheduling Tasks

Cron v Launchd: the "new mac" way is to use launchd now that cron has been depricated. In this case, the Linux/Mac stereotypes have been reversed. Launchd is less straightforward to use than a crontab, but is far more versatile allowing you to run a job as a different user without modifying a shell script. The toughest thing is creating your Launchd plist, but luckily there are some really nice people out there that have spent the time to demystify it

Once you've gotten the gist of it, use the man page to customize it to your needs (you can get the same info by typing `man launchd.plist` at the terminal prompt)

Date: 2012-03-16 15:02:42 CET

HTML generated by org-mode 6.33x in emacs 23