Skip to content

Instantly share code, notes, and snippets.

@brossi
Last active August 29, 2015 13:57
Show Gist options
  • Select an option

  • Save brossi/9860807 to your computer and use it in GitHub Desktop.

Select an option

Save brossi/9860807 to your computer and use it in GitHub Desktop.
Instructions for building for OS X
# Building on OS X 10.8 (Mountain Lion)
## Getting Started
OS X 10.8 (Mountain Lion) is a full 64-bit system, we’ll save some headaches by letting our compiler know that all compilation should assume 64 bits. Also, since Mountain Lion’s default PATH is `/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin`, we’ll want to change it so that Homebrew binaries will take precedence over OS X's stock binaries. To make these changes, open `~/.bash_profile` …
```
$ vim ~/.bash_profile
```
and add…
```bash
# Set architecture flags
export ARCHFLAGS="-arch x86_64"
# Ensure user-installed binaries take precedence
export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
# Load .bashrc if it exists
test -f ~/.bashrc && source ~/.bashrc
```
Let’s go ahead and source the file so it takes effect for the current session:
```
$ source ~/.bash_profile
```
With those first steps out of the way, now it’s time to get the necessary compilation tools in place.
## Installing Compiliation Tools
### Command Line Tools for XCode
Justin Mayer (Hacker Codex), has [written a nice guide](http://hackercodex.com/guide/mac-osx-mountain-lion-10.8-configuration/) to help you determine what version of XCode you will want to install, XCode (full) or the Command Line Tools for XCode.
>Installing development-related software in the past has required the compiler tool-chain that comes with Xcode. Thankfully, if you don’t need or want Xcode, those compiler tools are now available separately, saving download time and about four gigabytes of disk space. Assuming you have your Apple ID credentials handy, head over to the [Developer Downloads](https://developer.apple.com/downloads) area, download the Command Line Tools for Xcode, and install it.
>
>Alternatively, there are some reasons you might want the full version of Xcode:
>
> * To compile the few tools that won’t compile without the full version of Xcode
> * To download and manually compile open-source Mac applications
> * To develop your own Mac/iOS applications
>
> If you full into one of the above categories, download Xcode from either the [Developer Downloads](https://developer.apple.com/downloads) area or the [Mac App Store](http://itunes.apple.com/us/app/xcode/id448457090). Make sure you’re on a high-bandwidth connection, because Xcode is a massive beast. Once you’ve installed Xcode, launch the Xcode application, visit the app preferences, find the “Downloads” pane, and download the above-mentioned Command Line Tools from within the Xcode application (if you haven’t already installed them).
### XQuartz
X11 is not longer included with OS X 10.8, so Apple recommends that if you need the tool because it is a required dependency for another one of your tools, you should use [XQuartz](http://xquartz.macosforge.org/) in it's place.
Once you've downloaded the XQuartz .dmg, install it and then restart your computer to make sure the system is using it.
### Homebrew
[Homebrew](http://brew.sh) is the the package manager that we'll use to pull in the build dependencies. For those of you who do not want to use Homebrew, and would rather use MacPorts, you can find those [[installation instructions here]].
```ruby
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
```
After the script installs Homebrew, you will want to run the 'brew doctor' command to confirm that your system is configured correctly. If no problems are detected, go on to the next step.
```
$ brew doctor
Your system is ready to brew.
```
Next, verify that Homebrew is running the latest version:
```
$ brew update
```
> If the “brew update” command produces an error, make sure /usr/local is owned by you and not by root:
```
sudo chown $USER /usr/local
brew update
```
## Installing Dependencies
```
$ brew install boost miniupnpc openssl qrencode
```
Next, install Berkeley-DB 4.8
```
$ brew install berkeley-db4
```
> Note: If you had already installed a newer version of Berkeley-DB, you can run the command, `brew unlink berkeley-db`, first, to unlink it. After it's been disconnected, go ahead and run `brew install berkeley-db4`
http://pastebin.com/EuQyGjat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment