If you are using Apache JMeter™ on a macOS machine, you probably encountered an annoying issue: double clicking on a JMeter JMX script doesn’t open JMeter GUI automatically! Instead, to open a JMX script in JMeter you have to open the terminal, navigate to your bin folder, run the /jmeter.sh command, click the ‘Open’ button in JMeter and choose your JMX script.
Luckily for all you Mac users, there is a way to automate this manual procedure, by using Apple’s Automator, The Automator is an OS X application that creates workflows for automating repetitive tasks into batches.
Here is how you can use Automator to automate the process of opening a JMX script in JMeter:
1. Open the Automator on your Mac.
2. Choose ‘Application’.
3. In the search field, search for Run Shell Script and double click on this option.
4. Replace the ‘cat’ in the shell script field to the full path for your JMeter executable file (which is located in the bin folder of your jmeter installation) followed by ‘-t $@ &> /dev/null &’, for example: /Users/salgu02/Downloads/apache-jmeter-3.2/bin/jmeter -t $@ &> /dev/null &
5. Change the ‘Pass input’ on the top-right corner from ‘to stdin’ to ‘as arguments’.
6. Save the application and give it a name, for example ‘JMeter’.
7. Right click on a JMX script that you created, choose ‘Open With’ and select ‘Other..’.
8. Select the new ‘JMeter’ application you created with Automator, check the ‘Always Open With’ checkbox and click on ‘Open’.
9. Right click on a JMX file and click on ‘Get Info’.
10. Make sure that the ‘Open With’ is set to JMeter, click on ‘Change All...’ and then click on ‘Continue’.
That’s it! You can now double click on any JMX file and it will open this JMX script in JMeter automatically! It will look like this:
You can now also open a JMeter script by running the "open" command from your terminal, followed by the JMX file name (i.e. open myfile.jmx).
Want to learn more tips, tricks and best practices for using JMeter? You can learn JMeter for free through our JMeter academy.
You might also find these useful:
Interested in writing for our Blog? Send us a pitch!