Setting up Sonarqube to Analyze Xcode on Mac OSX

Setting up Sonarqube to Analyze Xcode on Mac OSX

August 27, 2014 5 By Tad Reeves

Sonarqube Nemo Analysis

Sonarqube is a web application platform, installable on Linux, Windows or OSX, which helps teams manage & fix code quality issues – things like ensuring coding standards are maintained, sufficient commenting, unit test coverage, functional test coverage, etc.

These were the basic steps in setting up a Mac OSX machine to run as a continuous integration agent to fire off Sonarqube (the artist formerly known as “Sonar”) analysis runs against the Xcode project, using Gradle as a build mechanism.

These instructions were used to install Sonar on a Mac Mini Server and a new Mac Pro, both running Mac OS X Mavericks 10.9.4.

CREATE DATABASE sonar CHARACTER SET utf8 COLLATE utf8_general_ci;
CREATE USER 'sonar' IDENTIFIED BY 'sonar';
GRANT ALL ON sonar.* TO 'sonar'@'%' IDENTIFIED BY 'sonar';
GRANT ALL ON sonar.* TO 'sonar'@'localhost' IDENTIFIED BY 'sonar';
FLUSH PRIVILEGES; 
  • Uncomment the line in /opt/sonarqube-3.7.4/conf/sonar.properties to tell it to use the local mysql db:
#----- MySQL 5.x
# Comment the embedded database and uncomment the following line to use MySQL
sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true
  • Download & install Groovy and Objective C plugins for Sonar. Download the jar for each and put into /opt/sonarqube-4.4/extensions/plugins
  • NOTE:  Whilst the Groovy plugin for Sonar is free, the Objective-C/C++ plugin is positively not.  Price at this writing was about $6500, though they will let you eval it for 14 days.   You’ll have to get a trial license key from their sales reps, and insert it into http://[sonarserver]:9000/settings?category=licenses
  • Restart Sonar, and when done, plugins are visible.