**Warning**: Compiling PhantomJS from source takes a long time, mainly due to thousands of files in the WebKit module. With 4 parallel compile jobs on a modern machine, the entire process takes roughly 30 minutes. It is highly recommended to download and install the ready-made [binary package]({{ site.url }}/download.html) if it is available.
## Mac OS X
Install [Xcode](https://developer.apple.com/xcode/) and the necessary SDK for development (gcc, various tools, libraries, etc).
First, install the development packages of the following tools and libraries: GNU C++ compiler, bison, flex, gperf, Perl, Ruby, SQLite, FreeType, FontConfig, OpenSSL, and ICU. The actual package names may vary from one distribution to another.
**Note**: `build.sh` by default will launch parallel compile jobs depending on the available CPU cores, e.g. 4 jobs on a modern hyperthreaded dual-core processor. If necessary, e.g. when building on a virtual machine/server or other limited environment, reduce the jobs by passing a number, e.g `./build.sh --jobs 1` to set only one compile job at a time.
**Note**: `git.exe` has to be on PATH. If you are using a wrapper (`git.cmd`, `git.bat`, etc.) modify `build.cmd` and replace `git.exe` with whatever you have on the PATH.