28 November 2010

Installing Emacs on Windows and OS X


If you are on a Mac, there are a couple of choices when it comes to emacs. You can go for Aquamacs, which is emacs, but polished up to make it more Mac like. In the past I recommended using Aquamacs, but I have since changed my mind and think it's better to stick with plain old emacs. Whatever you choose, just download it and install it like any other OS X application.


On windows its almost as simple. The current version of Emacs is 23.2, so grab the download from here (for the current version, the file you want is emacs-23.2-bin-i386.zip), and extract it into any folder on your machine, I choose C:\, which placed Emacs in C:\emacs-23.2


Emacs is highly customisable, and all the settings relevant to your setup are stored in a file called .emacs or _emacs. Emacs searches for this file in your home directory, which is fine on OS X and Linux, but what about windows where you don’t really have a home directory?

The trick is to create an environment variable called HOME that contains the location of a directory you wish to use. A sensible place to store your _emacs is in the Application Data folder, normally located at C:\documents and settings*username*\Application Data

To create the environment variable:

  1. Right Click on My Computer and select properties
  2. Click on the Advanced tab
  3. Click the environment variable button at the bottom
  4. Click the new button under the User variables for username pane
  5. Enter HOME as the variable name, and the location of the directory that will contain your _emacs file as the value


Now its time to fire up emacs. On the Mac, run the Emacs application you have just installed, on Windows double click on C:\emacs-23.2\bin\emacs.exe

The first thing you will notice is that Emacs behaves just like most other text editors – you can type stuff, open, close and save files using the menus etc. However, to start on the road to becoming a power user, you have to start learning the keyboard commands of which there are many!

The best way to learn is to work your way through the built-in tutorial. While reading it, you will quickly learn that most Emacs commands are accessed by holding the CRTL or ALT key and issuing some number of key presses. To open the tutorial, press and hold CTRL and type 'h'. Release all the keys and type 't' – the tutorial will then open, and it can teach you much more than I can!

blog comments powered by Disqus