Steps:

  1. Make sure you have homebrew installed in your machine, otherwise follow instrunctions at brew.sh.
  2. Open terminal, run brew install sonar. Assuming brew installs SonarQube successfully, take a look at the last line of the terminal where the SonarQube location is printed. In my case it is /usr/local/Cellar/sonarqube/7.1.
  3. Now run brew install sonar-scanner (N.B. sonar-runner is no longer available, it’s replaced by sonar-scanner).
  4. After installation is complete, run the following commands consecutively: export SONAR_HOME=/usr/local/Cellar/sonar-scanner/3.2.0.1227/libexec export SONAR=$SONAR_HOME/bin export PATH=$SONAR:$PATH [TODO: exporting path in this way will work for the current session of terminal, for permanent use, I need to transfer these path variables to .bashrc file.]
  5. Now we can run SonarQube from terminal by issuing this command /usr/local/opt/sonarqube/bin/sonar console.
  6. Go to http://localhost:9000/ to view the main page of SonarQube. Use this credentials (username: admin, password: admin) to login.

References (deprecated a bit):