I've just picked up a few of these UniFi APs and can of course see the download for 'UniFi Controller for Mac'. Is this the controller that I need to have installed to configure other geographical locations in the future (with the respective ports forwarded etc)? The Unifi Controller is dependent on the right Java runtime. Oracle has been constantly tightening their licensing, making it harder and harder to just run Java. So in the last few years, Apple stopped shipping the JRE. So Ubiquiti took up the slack and included the Java Runtime Environment in their Unifi.app.
I’m running a UniFi network here with wireless access points, the Security Gateway and a PoE switch. It seems to be a robust system and is almost certainly overkill, but reliability is high on my lists after bad experiences with a NetGear WiFi router.
The UniFi system software is called the Controller and runs on a various operating systems. As I have a Mac mini here, I decided to run it on there. Weirdly, however it runs as a GUI application which means that I have to be logged in. There’s no need for that though as by scouring the Internet I discovered that we can run it headless via launchd.
Firstly we create /Library/LaunchDaemons/com.unifi.controller.service.plist. This file has to be owned by root with group of wheel:
2 4 6 8 10 12 14 16 18 20 22 24 26 | <!DOCTYPE plist PUBLIC '-//Apple//DTD PLIST 1.0//EN' 'http://www.apple.com/DTDs/PropertyList-1.0.dtd'> <dict> <dict> <string>/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/sbin</string> <key>KeepAlive</key> <key>Label</key> <string>com.unifi.controller.service.plist</string> <true/> <array> <string>-c</string> <string>exec '/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java' -Djava.awt.headless=true -Xmx1024M -jar /Applications/UniFi.app/Contents/Resources/lib/ace.jar start</string> <key>RunAtLoad</key> <key>WorkingDirectory</key> <string>/Applications/UniFi.app/Contents/Resources/</string> </plist> |
![Ubiquiti software download Ubiquiti software download](https://forum-pt.ubnt.com/uploads/editor/rv/qetru03v761c.png)
This is a fairly standard launchd plist file file. However, the controller software is written in Java, but as Ubiquiti no longer bundle a copy of Java, we need to install our own copy of Java 8:
2 4 6 | <array> <string>-c</string> <string>exec'/Library/InternetPlug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java'-Djava.awt.headless=true-Xmx1024M-jar/Applications/UniFi.app/Contents/Resources/lib/ace.jarstart</string> |
(You may need change the path to where your Java 8 is installed.)
This means that when Ubiquiti updates the bundled Java, our service continues to work. We also need to set the working directory to the Resources directory of the app bundle as it doesn’t work otherwise…
Update: Since this post was written, Ubiquiti no longer bundle Java, I have updated appropriately based on the comment from Wade Gibson.
Secondly, we install the service: