Prologue
It started with a really simple idea… I just wanted to install the “World’s Simplest Service Broker” to wrap a user-provided service into a system wide service. Oh well, it was not that simple … so, here’s the full transcript of that trip.
Step 1 – Reading the instructions
On the page they provide a (local) build script as follows:
godep get
export BASE_GUID=$(uuid)
export CREDENTIALS='{"port": "4000", "host": "1.2.3.4"}'
export SERVICE_NAME=myservice
export SERVICE_PLAN_NAME=shared
worlds-simplest-service-broker
Step 2 – Installing the GO language
So I headed over to the GO homepage at https://golang.org/ and then to the respective download page: https://golang.org/dl/. There I found a download for Mac OSX: https://storage.googleapis.com/golang/go1.3.3.darwin-amd64-osx10.8.pkg
Then I needed the godep add-on. A quick search brought me to the respective github repo: https://github.com/tools/godep
Quickly cloned it and there it was in my local github folder. So, in order to execute the godep command I needed to get the respective bin folder (containing the commands) into my path. A bit of searching the web and I ended up creating a gocode folder, symlinking the content of the local godep repo into it and then making the respective settings in my shell environment (BTW, I used oh-my-zsh):
export GOPATH=/Users/d039236/dev/gocode
export PATH = $PATH:$GOPATH/bin:
Then I typed ‘godep get‘ into my terminal… and got the following error message:
>> go: missing Mercurial command. See http://golang.org/s/gogetcmd >> package code.google.com/p/go.tools/go/vcs: exec: "hg": executable file not found in $PATH
Step 3 – Mercurial
Alright… so Mercurial seems to be missing. Hence, I headed over to their download page and opted for the homebrew installation option.
# Mac OS (homebrew)
$ brew install mercurial
That’s when the fun started… here’s what I got in return:
>> => Downloading http://mercurial.selenic.com/release/mercurial-2.8.2.tar.gz >> ######################################################################## 100,0% >> ==> make PREFIX=/usr/local/Cellar/mercurial/2.8.2 install-bin >> /usr/local/Library/ENV/4.3/make: /usr/local/Library/ENV/4.3/xcrun: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby: bad interpreter: No such file or directory >> /usr/local/Library/ENV/4.3/make: line 3: /usr/local/Library/ENV/4.3/xcrun: Undefined error: 0 >> Error: Homebrew doesn't know what compiler versions ship with your version >> of Xcode (6.1). Please `brew update` and if that doesn't help, file >> an issue with the output of `brew --config`: >> https://github.com/Homebrew/homebrew/issues >> Thanks!
“Alrighty, then!” Seems like my ruby installation got sort of corrupted when upgrading to Yosemite. Now, I did some reading how-to fix it, but after half an hour I sort of gave-up and decided to take a short-cut. I ended up modifying the two following files:
- /usr/local/Library/ENV/4.3/xcrun/xcrun
- /usr/local/Library/brew.rb
Replacing the existing reference to Ruby to “#!/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby -W0”
So, I tried again:
$ brew install mercurial
Here’s what I got this time:
>> ==> Downloading http://mercurial.selenic.com/release/mercurial-2.8.2.tar.gz >> Already downloaded: /Library/Caches/Homebrew/mercurial-2.8.2.tar.gz >> ==> make PREFIX=/usr/local/Cellar/mercurial/2.8.2 install-bin >> ==> Caveats >> Bash completion has been installed to: >> /usr/local/etc/bash_completion.d >> zsh completion has been installed to: >> /usr/local/share/zsh/site-functions >> Set PYTHONPATH if you want Python to find your site-packages: >> export PYTHONPATH=/usr/local/lib/python2.7/site-packages:$PYTHONPATH >> Warning: Could not link mercurial. Unlinking... >> Error: The `brew link` step did not complete successfully >> The formula built, but is not symlinked into /usr/local >> You can try again using `brew link mercurial' >>Possible conflicting files are: >> ==> Summary >> /usr/local/Cellar/mercurial/2.8.2: 531 files, 7,4M, built in 23 seconds
Then I tried to link Mercurial agin using the afore mentioned command:
brew link mercurial
Only to be confronted with:
>> Linking /usr/local/Cellar/mercurial/2.8.2... Warning: Could not link mercurial. Unlinking... >> Error: Could not symlink file: /usr/local/Cellar/mercurial/2.8.2/bin/hg >> /usr/local/bin is not writable. You should change its permissions.
Your wish is my command… so, I adjusted the respective permissions and tried again.
brew link mercurial
>> Linking /usr/local/Cellar/mercurial/2.8.2... 358 symlinks created
Finally! (Well, not yet…) In the meanwhile I found out that just cloning the godep repo and symlinking it into the gocode folder won’t suffice, but that instead I should run a “go get github.com/tools/godep” command.
Fair enough… so I execute that command and I get the following response:
>> go: missing Mercurial command. See http://golang.org/s/gogetcmd >> package code.google.com/p/go.tools/go/vcs: exec: "hg": executable file not found in $PATH
Ok, that makes sense. Hence I add the Merurial bin to the path as well:
export PATH=$PATH:/usr/local/Cellar/mercurial/2.8.2/bin
Finally I was able to get the necessary binary of the “godep” package and continue with the actual task at hand: getting the service broker up & running.
Step 4 – Building the service broker
The last missing piece of the puzzle was to create a proper UUID as needed by the 2nd command of the build script. Fortunately that is easy to do on a MAC, hence I ran the “uuidgen” command to get my UUID.
Pooh… what a ride! I just wrote all of that down in case another poor soul runs in similar issues and may find this when searching the web…