mxcl/homebrew — Issue #8761: Emacs HEAD reinstall fails
Author: junkblocker
Created: 2011-11-23 23:14:44+00:00
State: open

I had installed emacs from head. Something like

```
% brew install emacs --HEAD --cocoa --use-git-head
% brew linkapps
```

And that worked. Now I have a script which essentially does an install || update

```
brew install emacs --HEAD --cocoa --use-git-head || brew upgrade emacs
brew linkapps
```

However, if I run that, the install fails

```
% brew install emacs --HEAD --cocoa --use-git-head
==> Cloning git://repo.or.cz/emacs.git
Updating /Users/maso/Library/Caches/Homebrew/emacs--git
==> Downloading patches
######################################################################## 100.0%
==> Patching
patching file lisp/term/ns-win.el
Hunk #1 succeeded at 926 with fuzz 1 (offset -337 lines).
patching file src/nsfns.m
Hunk #1 succeeded at 2639 (offset 50 lines).
Hunk #2 succeeded at 2752 (offset 48 lines).
patching file src/nsterm.h
Hunk #1 succeeded at 116 (offset 21 lines).
patching file src/nsterm.m
Hunk #1 succeeded at 795 (offset 109 lines).
Hunk #2 succeeded at 1276 (offset 138 lines).
Hunk #3 succeeded at 1332 (offset 122 lines).
Hunk #4 succeeded at 6061 with fuzz 2 (offset 439 lines).
Hunk #5 succeeded at 6169 (offset 436 lines).
Warning: Using copy_autogen
See https://github.com/mxcl/homebrew/issues/4852
==> autogen/copy_autogen
==> ./configure --prefix=/usr/brew/Cellar/emacs/HEAD --without-dbus --enable-locallisppath=/usr/brew/share/emacs/site-lisp --infodir=/usr/brew/Cellar/emacs/HEAD/share/info/ema
==> make bootstrap
==> make install
Error: File exists - /usr/brew/Cellar/emacs/HEAD/Emacs.app/Contents/MacOS/Emacs or /usr/brew/Cellar/emacs/HEAD/bin/emacs

zsh ~
% ls /usr/brew/Cellar/emacs
ls: /usr/brew/Cellar/emacs: No such file or directory
```

If I run the install with -vd it fails but succeeds when I exit the shell.

```
...
...
else true; fi ); \
done
Error: #
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/fileutils.rb:338:in `symlink'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/fileutils.rb:338:in `ln_s'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/fileutils.rb:1412:in `fu_each_src_dest0'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/fileutils.rb:336:in `ln_s'
/usr/brew/Library/Formula/emacs.rb:79:in `install'
/usr/brew/Library/Homebrew/build.rb:74:in `install'
/usr/brew/Library/Homebrew/formula.rb:265:in `brew'
/usr/brew/Library/Homebrew/formula.rb:618:in `stage'
/usr/brew/Library/Homebrew/formula.rb:547:in `mktemp'
/usr/brew/Library/Homebrew/formula.rb:616:in `stage'
/usr/brew/Library/Homebrew/formula.rb:260:in `brew'
/usr/brew/Library/Homebrew/build.rb:53:in `install'
/usr/brew/Library/Homebrew/build.rb:27
/usr/brew/Library/Formula/emacs.rb:97
==> Rescuing build...
When you exit this shell Homebrew will attempt to finalise the installation.
If nothing is installed or the shell exits with a non-zero error code,
Homebrew will abort. The installation prefix is:
/usr/brew/Cellar/emacs/HEAD
lse='_ls -d *(/^F)'

h - run-help on current command
OS : darwin10.0 Darwin 10.8.0
CPUs: 4
Mach: x86_64
Arch: MacBookPro6,2

zsh /private/tmp/homebrew-emacs-HEAD-VHBg
% exit
strip /usr/brew/Cellar/emacs/HEAD/bin/etags
strip /usr/brew/Cellar/emacs/HEAD/bin/emacsclient
strip /usr/brew/Cellar/emacs/HEAD/bin/emacs-24.0.91
strip /usr/brew/Cellar/emacs/HEAD/bin/ebrowse
strip /usr/brew/Cellar/emacs/HEAD/bin/ctags
==> Caveats
Emacs.app was installed to:
/usr/brew/Cellar/emacs/HEAD

Command-line emacs can be used by setting up an alias:
alias emacs="/usr/brew/Cellar/emacs/HEAD/Emacs.app/Contents/MacOS/Emacs -nw"

To link the application to a normal Mac OS X location:
brew linkapps
or:
ln -s /usr/brew/Cellar/emacs/HEAD/Emacs.app /Applications

Because the official bazaar repository might be slow, we include an option for
pulling HEAD from an unofficial Git mirror:

brew install emacs --HEAD --use-git-head

There is inevitably some lag between checkins made to the official Emacs bazaar
repository and their appearance on the repo.or.cz mirror. See
http://repo.or.cz/w/emacs.git for the mirror's status. The Emacs devs do not
provide support for the git mirror, and they might reject bug reports filed
with git version information. Use it at your own risk.
==> Finishing up
ln /usr/brew/bin/rcs-checkin
ln /usr/brew/bin/grep-changelog
ln /usr/brew/bin/etags
ln /usr/brew/bin/emacsclient
ln /usr/brew/bin/emacs-24.0.91
ln /usr/brew/bin/emacs
ln /usr/brew/bin/ebrowse
ln /usr/brew/bin/ctags
ln /usr/brew/share/man/man1/rcs-checkin.1.gz
ln /usr/brew/share/man/man1/grep-changelog.1.gz
ln /usr/brew/share/man/man1/etags.1.gz
ln /usr/brew/share/man/man1/emacsclient.1.gz
ln /usr/brew/share/man/man1/emacs.1.gz
ln /usr/brew/share/man/man1/ebrowse.1.gz
ln /usr/brew/share/man/man1/ctags.1.gz
ln /usr/brew/share/icons
ln /usr/brew/share/emacs/site-lisp/subdirs.el
ln /usr/brew/share/emacs/24.0.91
ln /usr/brew/share/applications
==> Summary
/usr/brew/Cellar/emacs/HEAD: 3774 files, 114M, built in 7.6 minutes
```