Emacs on Mac OSX with gocode

Emacs launched from Spotlight cannot get correct environment variables, thus gocode could not get GO pkg path.

To solve this, follow steps here:

1. Use ‘launched’ to set environment variables:
PATH as: /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/opt/local/bin:/usr/local/git/bin:/usr/local/go/bin
GOBIN as:/usr/local/go/bin
GOROOT as: /usr/local/go

2. After environment variables set, any application launched from Term can receive right PATH, GOBIN and GOROOT.
So next launch Emacs from Terminal.App to test:
/Applciations/Emacs.app/Contents/MacOS/Emacs

3. Create an alias in ~/.bash_profile like: alias startemacs=’/Applications/Emacs.app/Contents/MacOS/Emacs&’

see: http://emacswiki.org/emacs/EmacsApp

Leave a Reply

Your email address will not be published. Required fields are marked *