Mac – emacs on console “can not load file, package

emacsterminal

In my .emacs file, I try to install el-get with this code:

(unless (require 'el-get nil 'noerror)
  (require 'package)
  (add-to-list 'package-archives
               '("melpa" . "http://melpa.org/packages/"))
  (add-to-list 'package-archives
                      '("marmalade" . "http://marmalade-repo.org/packages/"))
  (package-refresh-contents)
  (package-initialize)
  (package-install 'el-get)
  (require 'el-get))
(add-to-list 'el-get-recipe-path "~/.emacs.d/el-get-user/recipes")
(el-get 'sync)

and get this in Messages:

Loading /Users/koxmoz/.emacs...
if: Cannot open load file: package

How can I solve this?

Best Answer

Neither package nor el-get are part of a standard OS X installation, they need to be installed manually.

But unless you are really keen on running emacs in terminal mode, I would recommend to install Aquamacs instead which provides a much better integration with OS X. Also, package is part of the standard installation.