What’s the Sonar?
Sonar is an open source platform for continuous inspection of the code quality.
I will mention how to setup on Mac step by step.
The official website of the Sonar says that “The only prerequisite for running SonarQube is to have Java (Oracle JRE 6 onwards) installed on your machine.”
I want to mention Homebrew in this tutorial.I actually can download and install Sonar by using its offical website as Jenkins installation process.However,This time installation process will be different than before.
What’s the Homebrew?
Homebrew is the package management system for Mac Operating System.
How can I Install it?
by entering this command in terminal:
ruby -e “$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)”
After I install homebrew into my machine I need to update brew for whether its installed successfully or not so I run this command in terminal: brew update
I’m ready to install Sonar using these commands:
brew install sonar
brew install sonar-scanner
After I execute these commands Sonar should be under this path:/usr/local/Cellar/sonar(brew always install under the /usr/local/Cellar/…)
This step is same with Jenkins installation so I need to set environment path of the Sonar
All exports should be like this:
echo $SONAR_HOME and $SONAR should return above paths.
After I set all export commands I can start to run Sonar in terminal by using this command:
or in current directory
After I used “sonar start” command I should to see main page of SonarQube on http://localhost:9000/.