Skip to content

Instantly share code, notes, and snippets.

@nathanhammond
Created March 4, 2012 21:48
Show Gist options
  • Star 23 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save nathanhammond/1974955 to your computer and use it in GitHub Desktop.
Save nathanhammond/1974955 to your computer and use it in GitHub Desktop.
How to get Emscripten running on OS X.

Running emscripten on OS X

There are a number of additional dependencies required for getting things installed on OS X. Starting with a blank slate OS X machine, this is the process it takes:

# Install Xcode Command Line Tools

# Install Homebrew
ruby -e "$(curl -fsSkL raw.github.com/mxcl/homebrew/go)"

# Some deps
brew install node spidermonkey closure-compiler yuicompressor
brew install llvm --with-clang

cd ~/Repos
git clone git://github.com/kripken/emscripten.git
@nathanhammond
Copy link
Author

One of the nice pieces about this script is that it ensures that (just about) every utility used by Emscripten is in $PATH, making .emscripten not entirely necessary.

@MySchizoBuddy
Copy link

Now a Windows equivalent is needed.

@apollograce
Copy link

Note that at least some parts of this script are now out of date. For instance, there are more recent versions of git, and emscripten says that the officially supported version of Clang is 3.1, not 3.0.

@anarchivist
Copy link

Why wouldn't you install Git with Homebrew?

@juj
Copy link

juj commented Feb 3, 2013

Windows version of getting started is available at https://github.com/kripken/emscripten/wiki/Using-Emscripten-from-Visual-Studio-2010

More out-of-date things on this gist is that the required Clang version is now 3.2, not 3.1. Also, one needs 'python2' executable, 'python' is no longer used on OSX.

@JKirchartz
Copy link

I've been unable to install Clang 3.2 with this method. Also updating Xcode hasn't helped, I now need to downgrade it since it's using LLVM 4.2 now.

also, if you've already got python installed & in your $PATH, from the directory where python's installed you can symlink it to python2 like this

ln -s python2.7 python2

I was able to install the appropriate version of clang through macports with

sudo port install clang-3.2

@mccahill
Copy link

I was having trouble getting brew to install Clang 3.2 until I updated brew -- the recipes were stale. after the update brew was able to install clang 3.2. Try this

brew update
brew outdated

@bkatiemills
Copy link

This script now appears to default to LLVM 3.3, which produces the error described at
https://groups.google.com/forum/#!topic/emscripten-discuss/OTxJ29JyOhg
when trying to compile the hello world example from the tutorial. Should this script ask for LLVM 3.2 instead, or is there a different preferred solution?

@larsxschneider
Copy link

@BillMills: Do you have a solution, yet?

@shovon
Copy link

shovon commented Aug 4, 2013

For everyone being slapped in the face with a version 3.3 of LLVM and Clang, the solution is simple: just manually download and install LLVM and Clang v3.2. For the lazy folks among us, you can just follow this guide: https://gist.github.com/shovon/6151878

Don't worry, this will not override your current installation of LLVM.

@bkatiemills
Copy link

@larsxschneider - yes, I messed with the homebrew script with an ugly, ugly kludge - see below. It worked, but I wanted the developer's opinion of what the most appropriate solution was.

@shovon - unfortunately your solution gives me a 'wget not found' complaint when I try and run your script on OSX 10.8.2. For those using homebrew, I offer the following, with absolutely no promises as to whether it's actually a good idea or not - but it's my best guess and it worked for me:

Hack the brew script to an older version. Please feel free to educate me on how to do this better:

brew edit llvm --with-clang

replace these lines:

url 'http://llvm.org/releases/3.3/cfe-3.3.src.tar.gz'

sha1 'ccd6dbf2cdb1189a028b70bcb8a22509c25c74c8'

with these lines:

url 'http://llvm.org/releases/3.2/clang-3.2.src.tar.gz'

sha1 'b0515298c4088aa294edc08806bd671f8819f870'

and these lines:

url 'http://llvm.org/releases/3.3/llvm-3.3.src.tar.gz'

sha1 'c6c22d5593419e3cb47cbcf16d967640e5cce133'

with these lines:

url 'http://llvm.org/releases/3.2/llvm-3.2.src.tar.gz'

sha1 '42d139ab4c9f0c539c60f5ac07486e9d30fc1280'

then reinstall:

brew install llvm --with-clang

Again, use at your own risk - shovon's wget-based solution may well be a better idea, but this worked for me where wget didn't.

@shovon
Copy link

shovon commented Aug 5, 2013

@billmills I guess I'd better update the guide to use cURL, instead of wget. OS X comes pre-installed with the former instead of the latter.

Or, the alternative would be to ask people to install wget.

@shovon
Copy link

shovon commented Aug 5, 2013

@billmills yet another update: https://gist.github.com/shovon/6151878

@mralexgray
Copy link

@billMills... you should be able to do what you described via brew install llvm32 --with-clang aka /usr/local/Library/Formula/llvm32.rb

@lancejpollard
Copy link

Now you can just do this:

brew install emscripten

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment