XCode 3 and the command line
November 08, 2007

One nice little bonus with XCode 3.0 (new with Leopard) is the inclusion of the xed command to invoke the xcode editor from the command line. It’s nice to be able to open an XCode window to edit files, and it’s particularly handy to be able to set P4EDITOR, SVN_EDITOR and other such environment variables to xed.

Something like this was possible before using open -b com.apple.Xcode, but the problem with that way of doing things is that you had to quit XCode afterwards to convince things like Perforce that your edits had been completed (perforce typically invokes the editor for you, then waits until you’ve finished editing a specification file before doing something with it).

The nice thing with the xed command is that it has a -w flag which does just what is needed in most cases - it sits in a loop spinning until XCode tells it that you have closed the file that it opened. This allows you to use XCode as your general text editor without it interfering with your normal work.

Nice touch…

« Nasty Recursion In Drupal Live Update dashboard widget »
Got a comment on this post? Let us know at @elegantchaoscom.