Installing NiFi on a MacBook

18 Dec 2017

Below, I documented the steps I had to take to install NiFi on my Mac using Homebrew:

I ran brew install nifi

Which resulted in this error: Homebrew must be run under Ruby 2.3! You're running 2.0.0. (RuntimeError)

So, I ran brew update-reset (as suggested by StackOverflow). That seemed to work.

I then ran brew install nifi and received this error:

Error: Xcode alone is not sufficient on Sierra.
Install the Command Line Tools:
  xcode-select --install

Obviously, I entered xcode-select --install and installed it. This took a few minutes.

Now trying brew install nifi again…

nifi: Java 1.8+ is required to install this formula.
JavaRequirement unsatisfied!
You can install with Homebrew-Cask:
 brew cask install java

Okay, running brew cask install java.

Now trying brew install nifi. Success! Nice!

Next up, try running NiFi via nifi run- I’m getting this error: WARN [main] org.apache.nifi.bootstrap.Command Launched Apache NiFi but could not determined the Process ID.

After some Googling, I determined that we need java8 for NiFi, not java9 (which Homebrew installs by default). You can check your java version with java --version.

You will need to take the following steps to delete java9 and switch to java8:

/usr/libexec/java_home -V – list all versions of Java on the machine

brew tap caskroom/versions – allow brew to lookup versions

brew cask install java8 – install java8 (if you haven’t already)

brew cask uninstall java – get rid of the default java9 (not strictly required)

export JAVA_HOME=$(/usr/libexec/java_home -v1.8) – set JAVA_HOME to java8

If you have completed all of the above steps, you should be able to now run nifi run and get something similar to below.

davisford$ nifi run

Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_152.jdk/Contents/Home
NiFi home: /usr/local/Cellar/nifi/1.4.0/libexec


INFO [main] org.apache.nifi.bootstrap.Command Launched Apache NiFi with Process ID 29854

We did it! You should be able to visit http://localhost:8080/nifi in your browser and get started.

Possible Issue: “JAVA_HOME not set; results may vary”

This warning occurs at the top of the output when using nifi run.

davisford$ nifi run
nifi: JAVA_HOME not set; results may vary
Java home:
NiFi home: /usr/local/Cellar/nifi/1.4.0/libexec

If you see the warning JAVA_HOME not set; results may vary when you use nifi run, you probably forgot to export JAVA_HOME in the above step.

Check your java8 installation location using /usr/libexec/java_home -V.

Update the JAVA_HOME var using export JAVA_HOME=$(/usr/libexec/java_home -v1.8).

Now run nifi run again and see if it works for you :)