Xcode 4.3 環境の Homebrew で Emacs をインストール

環境

  • OS: Mac OS X 10.7.3(Lion)
  • Xcode: 4.3 (Command Line Toolsをインストール)
  • Homebrew: 0.8.1
  • Emacs: 23.3b

失敗

以下のコマンドを実行したところ

$ brew install emacs --cocoa

"make bootstrap" でエラーになった。


...

/usr/bin/clang -c -Demacs -DHAVE_CONFIG_H -I. -I/private/tmp/homebrew-emacs-23.3b-5GZu/emacs-23.3/src -Dtemacs -Os -w -pipe -march=native -MMD -MF deps/nsfns.d nsfns.m
nsterm.m:5450:5: error: non-void method 'performDragOperation:' should return a value [-Wreturn-type]
return;
^
1 error generated.
make[2]: *** [nsterm.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [src] Error 2
make: *** [bootstrap] Error 2
==> Exit Status: 2
http://github.com/mxcl/homebrew/blob/master/Library/Formula/emacs.rb#L78

...

nsterm.m の 5450 行目

-(BOOL)performDragOperation: (id <NSDraggingInfo>) sender                                                                                                
{                                                                                                                                                        
  id pb;                                                                                                                                                 
  int x, y;                                                                                                                                              
  NSString *type;                                                                                                                                        
  NSEvent *theEvent = [[self window] currentEvent];                                                                                                      
  NSPoint position;                                                                                                                                      
                                                                                                                                                         
  NSTRACE (performDragOperation);                                                                                                                        
                                                                                                                                                         
  if (!emacs_event)                                                                                                                                      
    return;    <-- ここ                                                                                                                                             
                                                                                                                                                         
  position = [self convertPoint: [sender draggingLocation] fromView: nil]; 

で戻り値(YES or NO)がないのが原因?

"return NO;" となるようにパッチを当ててリベンジしたら今後は他の箇所で同じように怒られた...

成功

"--use-llvm"オプションをつけて実行する。

$ brew install emacs --cocoa --use-llvm

特にエラーもなく /usr/local/Cellar/emacs/23.3b/ にインストール完了。

あとは、/Applications/Emacs.app にリンクを張っておく。

$ ln -s /usr/local/Cellar/emacs/23.3b/Emacs.app /Applications

備考

Emacs だけでなく、他の Formula でもうまくいかない場合は、

$ brew doctor
でシステムに潜在的な問題がないか調べてみるとよいかも。