Install on macOS or Linux with Homebrew:
brew install nyg/jmxsh/jmxsh
Add the repository and install:
# Import the GPG key
curl -fsSL https://jmx.sh/apt/gpg.asc | sudo gpg --dearmor -o /usr/share/keyrings/jmxsh.gpg
# Add the repository
sudo tee /etc/apt/sources.list.d/jmxsh.sources << 'EOF'
Types: deb
URIs: https://jmx.sh/apt
Suites: stable
Components: main
Signed-By: /usr/share/keyrings/jmxsh.gpg
EOF
# Install
sudo apt update && sudo apt install jmxsh
Connect to any JMX-enabled JVM and explore MBeans interactively with tab completion and command history.
$ jmxsh Welcome to jmx.sh, type "help" for available commands. > open localhost:9999 Connection to localhost:9999 is opened. > domains The following domains are available: JMImplementation java.lang com.example > bean com.example:type=AppStats Bean is set to com.example:type=AppStats. > get RequestCount MBean = com.example:type=AppStats: RequestCount = 42; > run resetStats Calling operation resetStats of mbean com.example:type=AppStats with params []. Operation returns: null > close Disconnected. > quit Bye.
Values are converted to the types the operation declares. Beyond primitives and strings, Instant, UUID, enums, arrays, collections and maps are parsed for you, and -j passes every parameter as one JSON value.
> info -o schedule %0 - void schedule(java.time.Instant p1), Operation exposed for management > run schedule 2026-01-01T00:00:00Z > run sum [1,2,3] Operation returns: 6 > run -j '[3, 5]' add Calling operation add of mbean com.example:type=Calculator with params [3, 5]. Operation returns: 8 > run -j '{"p1": 3, "p2": 5}' add Operation returns: 8
JSON containing spaces must be quoted, since the prompt splits a line into arguments before the command sees it. A JSON array binds by position, a JSON object binds by parameter name. For a plain standard MBean the JVM synthesises the names p1, p2, … (p0, p1, … for MXBeans); info -o <op> prints the names -j expects. The same conversion applies to set, so set Deadline 2026-01-01T00:00:00Z works on an Instant attribute.
Automate JMX operations with scripts and pipes — perfect for monitoring, alerting, and CI/CD pipelines.
Run commands from a file:
jmxsh -l localhost:9999 --input commands.txt
Pipe commands via stdin:
echo "open localhost:9999 && beans" | jmxsh -n
| Command | Description |
|---|---|
open <host:port> | Connect to a remote JMX endpoint (RMI) |
open jmxmp://<host:port> | Connect to a remote JMX endpoint (JMXMP) |
open <pid> | Attach to a local JVM by process ID |
domains | List all MBean domains |
domain [name] | Show or set the current domain |
beans | List all MBeans (filter by domain with -d) |
bean <name> | Select an MBean for subsequent operations |
info | Show attributes and operations of the selected MBean |
get <attr> | Read an MBean attribute |
set <attr> <value> | Write an MBean attribute |
run <op> [args] | Invoke an MBean operation |
run -j <json> <op> | Invoke an MBean operation with JSON parameters |
watch <attr> | Poll an MBean attribute and print its value continuously |
subscribe | Subscribe to the notifications of an MBean |
unsubscribe | Unsubscribe from the notifications of an MBean |
close | Disconnect from the JMX endpoint |
alias <name> [target] | Define, show or list connection aliases |
unalias <name> | Remove a connection alias |
jvms | List local Java processes |
help | Show all available commands |
quit | Exit jmxsh (also exit or bye) |
Tab completion and command history powered by JLine.
Connect via host:port (RMI), jmxmp:// (JMXMP), JMX URL, or local PID.
Browse domains, read/write attributes, invoke operations.
Pass parameters as JSON with -j, and let types like Instant, enums and arrays be parsed for you.
Watch attribute values with watch, receive MBean notifications with subscribe.
Name your frequent connection targets and reuse them in open or -l.
Show the connected server, domain and bean in the prompt via a simple template.
Run multiple commands in one line with &&.
Automate via files or piped input; quiet mode (-q) keeps output clean.
Follows the XDG Base Directory spec — keeps your home directory clean.