Installing distcc on OSX 10.10 Yosemite

I am attempting to do something I haven’t seen done yet, so I figured I would document this here in case someone finds this useful.

I intend to get a distcc server running on OSX Yosemite to compile for various Linux machines. It seems that most people want to do the opposite, but in my case the Mac is the most powerful machine I own.

The first thing I need to do is install distcc. To ease that process I am going to need to get Homebrew working again. I hadn’t attempted to use it since upgrading to Yosemite, but quickly found out that it was no longer working.

I started out with some instructions that I found after a quick search. The problem stems from an updated version of Ruby in Yosemite. This is fixed by modifying one of Homebrew’s files.

It is probably worth noting that I logged in as the superuser to do this, though it should be possible as an administrator by adding ‘sudo’ at the beginning of the console commands.

I modified the brew.rb file as instructed. Here are some quick commands I used:

vim /usr/local/Library/brew.rb

Once in vim, I executed the following commands to change the version reference from 1.8 to current:

:s/1.8/Current/

Then write and quit.

:wq

After doing this, the instructions I used note that you need to commit the changes in brew’s repository. The instructions used $(brew –repository) to get the correct directory, but this didn’t work for me. There was no .git folder in /usr/local/Library/, but I tried the commit there anyway and it worked.

git commit -a -m 'new ruby version 2.0'

Now for the test, I ran brew update and it did failed during a ‘git pull’ with the following error:

Error: Failure while executing: git pull -q origin refs/heads/master:refs/remotes/origin/master

Running brew update again gave the following message, which provided some better clues:

/usr/local/Library/brew.rb:2: syntax error, unexpected <<
<<<<<<< HEAD
^

Editing the brew.rb file again showed some strange stuff in the first few lines. I removed the 3 lines that started with <<<<<, >>>>, and ====. After writing the changes, I committed them again:

git commit -a -m 'fix after update'

Another ‘brew update’ and everything seems to be as it should. Just for good measure I ran brew upgrade and waited for it to finish (been a while since doing this). Now to try installing distcc.

brew install distcc

Seems like it worked; gave the following output:

==> Downloading https://distcc.googlecode.com/files/distcc-3.2rc1.tar.gz
######################################################################## 100.0%
==> ./configure --prefix=/usr/local/Cellar/distcc/3.2rc1
==> make install
==> Caveats
Use 'brew services start distcc' to start distccd automatically on login.
By default, it will allow access to all clients on 192.168.0.1/24.

To have launchd start distcc at login:
mkdir -p ~/Library/LaunchAgents
ln -sfv /usr/local/opt/distcc/*.plist ~/Library/LaunchAgents
Then to load distcc now:
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.distcc.plist
==> Summary
/usr/local/Cellar/distcc/3.2rc1: 88 files, 2.1M, built in 23 seconds

That’s it for actually installing distcc. The hard part is going to be creating a cross-compiling environment to accomplish what I want to do.

I’ll be posting a follow-up article going over that part in the future.