Difference between revisions of "Installing Emacs on OS X"

From WikEmacs
Jump to navigation Jump to search
(→‎Build it from source: Create an alias for emacs, leaving the default emacs installed)
(Simplified command)
(15 intermediate revisions by 11 users not shown)
Line 1: Line 1:
OSX comes with a preinstalled version of Emacs, but alas it the oudated Emacs 22. Obtaining a newer Emacs on OS X is really simple. There are several popular ways to do it.  
+
OS X comes with a preinstalled version of Emacs, but alas it is the outdated Emacs 22. Fortunately, obtaining a newer release is really simple. There are several popular ways to do it.  
  
 
== Emacs 24 ==
 
== Emacs 24 ==
Line 5: Line 5:
 
=== As a binary package ===
 
=== As a binary package ===
  
Simply download a binary from [http://emacsformacosx.com Emacs for OSX]
+
Simply download a binary from [http://emacsformacosx.com Emacs for OSX].
  
=== Build it from source ===
+
The above binary distribution bundled with up-to-date versions [http://www.gnu.org/software/auctex/ AUCTeX], [http://ess.r-project.org ESS] and a few other useful tools is available
 +
from [http://vgoulet.act.ulaval.ca/en/emacs/mac/ Vincent Goulet's web site].
  
The second easy way to obtain Emacs 24 is via [http://mxcl.github.com/homebrew/ homebrew]. Just type the following incantation in your shell and you’re done:
+
=== MacPorts ===
 +
 
 +
If you have [https://www.macports.org/ MacPorts] installed, you can just do:
 +
 
 +
<source lang="bash">
 +
$ sudo port install emacs
 +
</source>
 +
 
 +
to install Emacs 24. The MacPorts installer updates your PATH environment variable, so the MacPorts build of Emacs should be found by your shell before the (outdated) build that comes with Mac OS when you type 'emacs'. If you prefer the Emacs.app build, that's available by executing:
 +
 
 +
<source lang="bash">
 +
$ sudo port install emacs-app
 +
</source>
 +
 
 +
=== Homebrew ===
 +
 
 +
Emacs 24 is also available via [http://mxcl.github.com/homebrew/ homebrew]. Just type the following incantation in your shell and you’re done:
  
 
<source lang="bash">
 
<source lang="bash">
 
$ brew update
 
$ brew update
$ brew install emacs --cocoa
+
$ brew install emacs --with-cocoa
$ ln -s /usr/local/Cellar/emacs/24.1/Emacs.app /Applications
+
$ brew linkapps emacs
or
 
$ cp -r /usr/local/Cellar/emacs/Emacs.app /Applications/
 
 
</source>
 
</source>
 
The second step is optional, but it’s recommended if you like to start Emacs from the launchpad or from Spotlight.
 
The second step is optional, but it’s recommended if you like to start Emacs from the launchpad or from Spotlight.
Line 30: Line 45:
  
 
<source lang="bash">
 
<source lang="bash">
$ alias emacs="/usr/local/Cellar/emacs/24.1/Emacs.app/Contents/MacOS/Emacs -nw"
+
$ alias emacs="/usr/local/Cellar/emacs/24.x/Emacs.app/Contents/MacOS/Emacs -nw"
 
</source>
 
</source>
  
 
To make it permanent, if using bash, add that line to ~/.bash_profile.
 
To make it permanent, if using bash, add that line to ~/.bash_profile.
  
That’s all folk! You may now proceed to the configuration section.
+
That’s all folks! You may now proceed to the configuration section.
 
 
== Emacs 23 ==
 
 
 
=== As a binary package ===
 
  
Simply download a binary from [http://emacsformacosx.com/builds Emacs for OSX].
+
=== Rudix ===
  
=== Use a package manager (Emacs 23 only at time of writing) ===
+
Emacs is easy to install directly from [http://rudix.org Rudix] as a .pkg or with the Rudix command line tool:
  
* Fink
 
* MacPorts
 
 
<source lang="bash">
 
<source lang="bash">
port install emacs
+
% sudo rudix install emacs
 
</source>
 
</source>
  
You can add <tt>+<variant> [+<variant>...]</tt> where <tt>variant</tt> is one or more of:
+
== Emacs 23 ==
* dbus: Builds emacs with D-Bus support
+
 
* gtk: Builds emacs as an X11 program with GTK+2 widgets
+
Binaries for Emacs 23 are still available from [http://emacsformacosx.com/builds Emacs for OSX].
* motif: Builds emacs as an X11 program with Motif
 
* universal: Build for multiple architectures
 
* x11: Builds emacs as a X11 program with Lucid widgets
 
The gtk, motif and x11 variants require (depend on) MacPorts' X11 libraries. They're mutually exclusive.
 
  
 
== Aquamacs ==
 
== Aquamacs ==
  
A near-OS-X-native port of GNU Emacs, integrating Emacs with all the features of Mac OS X.
+
A near-OS-X-native port of GNU Emacs, integrating Emacs with all the features of Mac OS X. Available [http://aquamacs.org/ here]. As of January 2015, the latest version (3.2) is based on Emacs 24.4. Comes bundled with some handy packages like [[AUCTeX]].
  
 
[[Category:OS X]][[Category:Beginner]][[Category:Install Or Upgrade]][[Category:Emacs-23]][[Category:Emacs-23.4]][[Category:Emacs-24]]
 
[[Category:OS X]][[Category:Beginner]][[Category:Install Or Upgrade]][[Category:Emacs-23]][[Category:Emacs-23.4]][[Category:Emacs-24]]

Revision as of 20:06, 8 December 2015

OS X comes with a preinstalled version of Emacs, but alas it is the outdated Emacs 22. Fortunately, obtaining a newer release is really simple. There are several popular ways to do it.

Emacs 24

As a binary package

Simply download a binary from Emacs for OSX.

The above binary distribution bundled with up-to-date versions AUCTeX, ESS and a few other useful tools is available from Vincent Goulet's web site.

MacPorts

If you have MacPorts installed, you can just do:

$ sudo port install emacs

to install Emacs 24. The MacPorts installer updates your PATH environment variable, so the MacPorts build of Emacs should be found by your shell before the (outdated) build that comes with Mac OS when you type 'emacs'. If you prefer the Emacs.app build, that's available by executing:

$ sudo port install emacs-app

Homebrew

Emacs 24 is also available via homebrew. Just type the following incantation in your shell and you’re done:

$ brew update
$ brew install emacs --with-cocoa
$ brew linkapps emacs

The second step is optional, but it’s recommended if you like to start Emacs from the launchpad or from Spotlight.

Chances are good you have an older version of Emacs installed by default with OS X. It's suggested you to remove that older Emacs version to avoid conflicts with the new one. Do this:

$ sudo rm /usr/bin/emacs
$ sudo rm -rf /usr/share/emacs

Or just create an alias in your shell and when you invoke 'emacs' it will run the newly installed version:

$ alias emacs="/usr/local/Cellar/emacs/24.x/Emacs.app/Contents/MacOS/Emacs -nw"

To make it permanent, if using bash, add that line to ~/.bash_profile.

That’s all folks! You may now proceed to the configuration section.

Rudix

Emacs is easy to install directly from Rudix as a .pkg or with the Rudix command line tool:

% sudo rudix install emacs

Emacs 23

Binaries for Emacs 23 are still available from Emacs for OSX.

Aquamacs

A near-OS-X-native port of GNU Emacs, integrating Emacs with all the features of Mac OS X. Available here. As of January 2015, the latest version (3.2) is based on Emacs 24.4. Comes bundled with some handy packages like AUCTeX.