1. Find the JDK installation path
Open the terminal and enter /usr/libexec/java_home -v 1.8 where 1.8 is the JDK version number
localhost:~ mac$ /usr/libexec/java_home -v 1.8 /Library/Java/JavaVirtualMachines/jdk1.8.0_111.jdk/Contents/Home
2. Start visualVM
Switch to the bin directory of the directory where the JDK is located, and run ./jvisualvm. Other available commands are as follows:
appletviewer jarsigner javafxpackager jcmd jhat jmc jstack keytool policytool schemagen unpack200 extcheck java javah jconsole jinfo jps jstat native2ascii rmic serialver wsgen idlj javac javap jdb jjs jrunscript jstatd orbd rmid servertool wsimport jar javadoc javapackager jdeps jmap jsadebugd jvisualvm pack200 rmiregistry tnameserv xjc