Code and text editors on MacOS X

One of the things we spend the most time doing as astronomers is writing text and/or code, whether to develop a pipeline to reduce/plot data, write papers/proposals, or write simulation codes. Choosing a good text editor is just as important as having a good chair to sit on, and can have a big impact on productivity! In this post, I will go over a few of the best text/code editors out there for MacOS X.

Update (Sep 21, 2012 by Kelle): New text editor on the block is Sublime Text and it looks just as powerful as TextMate, but more so. Many packages are available for both LaTeX and Python (but maybe not IDL, as far as I can tell). Check out these tutorials to see some of the more advanced features in action. Sublime will cost your grant (or your advisor’s grant) $70 USD.

If any text editor can be compared to a swiss army knife, it is TextMate. It provides support, through bundles, to over 150 programming languages (C/C++, Fortran, Python, Perl, Ruby, LaTeX, HTML, …) and tools (subversion, diff, mercurial, …). One can create projects with multiple files, search and replace text simultaneously in many files, and typeset LaTeX files. Customizable syntax highlighting makes writing text/code pleasant, and code collapsing and expanding makes editing long programs much more manageable (for example, one can ‘collapse’ if statements and do loops in Fortran). One great feature is the ability to just type ‘mate filename’ or ‘mate directory’ on the command-line, and have the file or directory open in TextMate. A number of bundles are installed by default to support programming languages, but if your favorite one is missing, there are instructions on installing bundles here. Be sure to check out the screencasts to make the most out of TextMate. At around $50, a license is a little pricey, but you can try out a 30-day demo to help you decide whether you like it! There is a 15% education discount, and larger discounts if you order 4 or more licenses.

Emacs needs no introduction, but what I want to mention here is not the old command-line emacs, nor the X11 version xemacs, nor the modified emacs for OSX, Aquamacs, but the official Emacs which is now available in native mode for MacOS X (no X11 needed). Emacs has support for many programming languages, and has fantastic auto-indent capabilities: despite being a heavy TextMate users, I always run Fortran 95 files through Emacs to tidy up the indentation! The Emacs team does not provide pre-built Mac versions, but cutting edge builds can be downloaded from this website. Emacs is, of course, free.

Another (free) powerful text editor that is definitely worth trying out is TextWrangler which is a ‘lite’ version of the commercial editor BBEdit. TextWrangler is simpler than TextMate, but has saved me in a few cases where strange non-ASCII characters have made it into a text file, as it has a nice ‘Zap Gremlins’ feature than can remove any non-ASCII character. Syntax highlighting is of course present, as well as the ability to open multiple files in the same window. One very useful feature is the ability to edit a file directly from an FTP or SFTP server (SFTP basically allows you to access files on any computer that is accessible through SSH).

Finally, no discussion of text/code editors would be complete without mentioning the unavoidable TexShop that many of us already use to write papers/proposals. It is a great LaTeX editor, but many users miss out on some very useful features. Some features that may have eluded users are: if you press the command (apple) key and click on a word in the source, it will show it in the PDF, and vice-versa; there are very useful LaTeX and Matrix windows in the ‘Window’ menu, that make it easy to insert mathematical/greek symbols, and build matrices, without having to lookup how to do this on the web; and there are many scripts to typeset a file, not just the default ‘Latex’: for example, the cryptically named ‘latexmk’ will actually run the usual latex/bibtex/latex/latex that BibTeX users are familiar with.

These are just a few of the text/code editors available on MacOS X, but we think that these are some of the best available. Do you use any of these? Do you know of any other great text/code editors?

TextMate, $50, $42.50 educational, bulk and site licenses
Sublime, $70
Emacs, free
TextWrangler, free
TexShop, free

14 comments… add one
  • Marcos Jun 21, 2010 @ 8:13

    Just a reminder that if you use the FTP/SFTP client Cyberduck, it can invoke any number of editors in addition to TextWrangler on text files on the server, automagically downloading and re-uploading the file seamlessly. Even though I use TextWrangler, I always used it on remote files via Cyberduck.

  • John Jun 21, 2010 @ 8:22

    Linking back to the previous discussion, you can, of course, use Macports to install the native (Cocoa) version of Emacs:

    $ sudo port install emacs-app

    And, of course, there’s also (Mac)Vim (also available from Macports).

    Personally, I don’t like learning different editors for different platforms, so, since it’s not generally possible to use Macs exclusively, I prefer to stick to one of those.

  • Matt K Jun 21, 2010 @ 12:23

    I’d add to John’s comment that MacVim is coded as a native Mac application, and is very fast, with syntax highlighting and auto indenting to your heart’s content.

    For writing documentation and general LaTeX goodness, LyX is pretty good as a LaTeX WYSIWYM editor, and the export to latex has saved me many a headache.

  • Kelle Jun 21, 2010 @ 13:47

    Transmit is another FTP client that has a remote editing feature. Actually, the new version of Transmit deserves its own post….

  • Kathleen L Jun 21, 2010 @ 15:56

    Thanks for the summary. I will definitely check those tools out, except emacs which I despise (I know, heresy).

    I am still an old fan of nedit; simple, complete, easy to customize, and works on Linux too, which gives me a uniform interface as a work on my various computers. The best way to install it on Mac is through Fink.

    For software development, especially when a repository is involved, a software engineer introduced me to Eclipse. I have to admit that it is quite good. I use only a sliver of the features it offers but those are totally worth it. The svn handling is a great time saver. It is a bit confusing to install, especially the plug-ins, however.

  • Marcos Jun 24, 2010 @ 13:03

    Transmit is indeed a legendary FTP client. Of course then there is Coda too., but I don’t know that would be a good choice for non web-developer types.

  • Shashi Jun 28, 2010 @ 8:35

    Try TeXworks : – it is a cross platform editor and previewer for latex. I like the feature where one can jump from the pdf to the latex source and continue editing at that point. Works with multiple file source documents too!

  • Eli Jul 6, 2010 @ 19:07

    Shashi, thanks for the recommendation to TeXworks. I’m currently using OSX and Ubuntu between two work environments and this multi-platform TeX editor is great. For such a young project it’s impressive!

  • Ross Aug 3, 2010 @ 4:28

    As I already use Eclipse for Java programming, I’ve also installed its PyDev extension for Python development, and TeXlipse extension for LaTeX typesetting. It does all three things very well and in the same environment with support for version control via SVN etc. My only gripe is that its a bit of memory hog and slower than any native application would be, but no native application comes close to the breadth of features Eclipse provides (and it is cross-platform after all).

    I haven’t tried X-Code for development, apparently it supports Python too, has anyone else tried it?

  • Basavaraj Sep 21, 2013 @ 5:03

    Nice and useful write up about editors

    Was wondering why no mention of sublimetext, which is a cross platform editor, i use this on all 3 big OS (OS X, Ubuntu, Win 8) and it works smoothly

    it is similar to TexMate with a python based bundle concept and can support many programming languages

  • Stas Ustimenko Jun 4, 2015 @ 9:27

    I recommend Codelobster:
    It works much better for me

  • Tim Oct 6, 2015 @ 13:07

    I’ve been trying Archimedes on OS X for some light writing that involves mathematical equations: . Love its inline support for LaTeX.

  • ilia Dec 3, 2017 @ 7:40

    Coda, Atom and Brackets are very good code editors as well. Here is my editors review, hope you’ll find it useful:

Leave a Reply

Your email address will not be published. Required fields are marked *