Setting the Default Editor - Mac OS Style

Posted on 30 April 2008 by Johannes Fahrenkrug. Tags: mac tutorials apple
This is really short and can most likely be found in a million different places online. Well, now the count is up to a million and one.
You want to set the EDITOR environment variable for on Mac OS X? You're puzzled that there's (possibly) no .profile or .bash_profile in your home directory? You are distressed, scared, and disoriented because you don't know where to put your environment variables? Alas! Thou shalt wonder no more!

Just run this in your

open /Developer/Applications/Utilities/Property\ List\ ~/.MacOSX/environment.plist

(This assumes that you have the XCode development tools installed. If you don't just use vi and edit the XML file by hand. I also assume that you have a .MacOSX subdirectory in your home folder which contains an environment.plist file)

You will be greeted with something like this:

Then just click on "Root" and then click on "New Child" and enter the data for your EDITOR variable so it looks something like this:

Save and quit Property List Editor.

My environment.plist file now looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "
<plist version="1.0">

Now you have to log out and log back in for the changes to take effect. After that you should see "EDITOR=vi" when you run

set | grep EDITOR


Please keep it clean, everybody. Comments with profanity will be deleted.

blog comments powered by Disqus