How to change primary text editor (terminal)

I just got my first mac (I decided to switch over from gentoo linux), and I can't seem to figure out how to set my default text editor. I've been looking for rc.conf or something similar, but can't seem to figure out how to change my default editor from vi. If anyone could point me in the right direction, I'd be eternally grateful. Thanks in advance.

MacBook Pro, Mac OS X (10.5.7)

Posted on Jun 26, 2009 12:42 PM

Reply
5 replies

Jun 27, 2009 6:36 AM in response to bfarman

I was just looking for some sort of system wide, single file I could edit like rc.conf where I could set the editor env var to /usr/bin/emacs.

How about

/etc/profile # sh, bash, zsh
/etc/csh.login # csh, tcsh

This would handle all terminal sessions.

If for some reason you expect to be able to launch emacs from a GUI, then you can add environment variables to a GUI login session via

$HOME/.macosx/environment.plist

There is a nice free 3rd party System Preference (RCEnvironment) you can download and use for maintaining the environment.plist
<http://www.versiontracker.com/dyn/moreinfo/macosx/15073>

This would make sure that your GUI login processes always had EDITOR=/usr/bin/emacs

If you have multiple GUI logins you would have to apply the environment.plist change to each account (which is different from the /etc/profile and /etc/csh.login which is global for all Terminal sessions).

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

How to change primary text editor (terminal)

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.