This guide instructs step-by-step on how to setup LLVM3.3 on Mac OS X. The steps have been tested against OS X version 10.8.3.
- Install svn if you do not have it yet. It is distributed with XCode Command Line Tools in OSX App Store. See http://superuser.com/questions/455214/where-is-svn-on-os-x-mountain-lion
- Install XCode from OSX App Store.
- In XCode->Preferences->Downloads, install Command Line Tools.
- Test that svn works from command line: type
svn --versionin terminal.
- Install git if you do not have it yet:
- Allow installation of unsigned packages, or installing git package won’t succeed: https://www.my-private-network.co.uk/knowledge-base/apple-related-questions/osx-unsigned-apps.html
- Download and install git from http://git-scm.com/
- Test that git works from command line: type
git --versionin terminal.
- Install cmake if you do not have it yet:
- Download and install cmake-18.104.22.168-Darwin64-universal.dmg or newer from http://www.cmake.org/cmake/resources/software.html
- Test that cmake works from command line: type
cmake --versionin terminal.
- Build LLVM+Clang 3.3 from SVN repository:
cd ~ svn co http://llvm.org/svn/llvm-project/llvm/tags/RELEASE_33/final llvm33 cd llvm33/tools svn co http://llvm.org/svn/llvm-project/cfe/tags/RELEASE_33/final clang cd ../.. mkdir llvm33build cd llvm33build cmake -DCMAKE_BUILD_TYPE=Release -G "Unix Makefiles" ../llvm33 make
- After these steps, Clang 3.3 will be built into ~/llvm33build/bin. The source tree ~/llvm33 is not needed anymore, if you want to conserve disk space.
- Set up Clang 3.3 in PATH:
cd ~ echo "export PATH=~/llvm33build/bin:\$PATH" >> .profile
- The above change is permanent and it persists between system restarts. It only affects the current user.
- Close all terminal windows, and open a new one. Check that clang works ok in path:
cd ~ clang --version
The command should output:
clang version 3.3 (184461)
Thread model: posix