Start developing Hue on a Mac in a few minutes!

Start developing Hue on a Mac in a few minutes!

You might have already all the pre-requisites installed but we are going to show how to start from a fresh Yosemite (10.10) or El Capitan (10.11) install and end up with running Hue on your Mac in almost no time!

Screenshot 2015-03-24 09.11.26

We are going to be using the official Quickstart VM from Cloudera that already packs all the Hadoop ecosystem components your Hue will talk to. If you don’t have the latest already downloaded and running, please visit this link and choose the versions that suits you the best.

In the meanwhile, let’s set up your Mac!

Step 1: Clone the Hue repository
To clone the Hue Github repository you need git installed on your system. Git (plus a ton of other tools) is included in the Xcode command line tools. To install it open Terminal and type

xcode-select --install

In the dialog choose “Install”. If on Terminal you have the message “xcode-select: error: command line tools are already installed, use “Software Update” to install updates” it means you are almost good to go already.

From Terminal, navigate to a directory where you keep all your project and run

git clone https://github.com/cloudera/hue.git

You now have the Hue source code in your Mac.

Step 2: Install Java
The build process use Java to run. A quick way to get to the right download URL from Oracle is to run from Terminal

java -version

and then click on the “More info” button on the dialog that appears. On Oracle’s website, accept the license and choose the Mac OS X JDK link. After the DMG has been downloaded, open it and double click on the installation package. Now, if we return to the Terminal and type again

java -version

we will have the version of the freshly installed JDK. At the time of writing, 1.8.0_40.

Step 3: Install the pre-requisites
Hue uses several libraries that are not included in the XCode command line tools so we will need to install that too. To do that we will use Homebrew, the fantastic open source package manager for Mac OS X. Install it from Terminal with

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

You will need to enter your password to continue. Then, as suggested by the installation script, run

brew doctor

If you already have Homebrew installed, just update it running

brew update

As a first thing, we need to install Maven 3

brew install maven

And then Mysql to have the development libraries for it

brew install mysql

This will install also lib-openssl. Let’s go on install GMP

brew install gmp

Step 3b (just for El Capitan and Sierra): export ENV variables for openssl
If you have OS X El Capitan or macOS Sierra, you need an extra mini step to be able to make Hue:

export LDFLAGS=-L/usr/local/opt/openssl/lib && export CPPFLAGS=-I/usr/local/opt/openssl/include

Step 4: Compile and configure Hue

Now that we are all set with the requirements we can compile Hue by running

make apps

from the Hue folder that was created by the git clone in step 1. After a while, if everything goes as planned, you should see as a last build message something like “N static files copied to …”.

Screenshot 2015-03-24 09.09.20

Hue comes with a default configuration file that points all the service to the local machine. Since we are using a VM for this purposes, we will need to change several conf lines. For your convenience, we have the file readily available here.

Just copy this file over to your hue/desktop/conf folder!

Step 5: Configure your /etc/hosts
The last thing we should do is to start the Quickstart VM and get its IP address

Screenshot 2015-03-24 08.56.33

(you can launch the terminal inside the VM and run ‘ifconfig’ for that; in my case it’s 172.16.156.130). Then, on your Mac, edit the hosts file with

sudo vi /etc/hosts

and add the line

172.16.156.130 quickstart.cloudera

with the IP you got from the VM. Save and you are good to go!

Step 6: Run!
What you have to do on Terminal from the Hue folder is just

./build/env/bin/hue runserver

And point your browser to http://localhost:8000! Go and write a new app now! 🙂

Screenshot 2015-03-23 13.35.34

 

As usual feel free to comment on the hue-user list or @gethue!