A blog about electronics and programming
Home Electronics Running STM32CubeMX on Mac OS. Finally!

Running STM32CubeMX on Mac OS. Finally!

by Carmine Noviello
Published: Last Updated on 19 comments 1.9K views 3 minutes read

[box type="warning" align="" class="" width=""]Read carefully

This post is outdated, since the latest CubeMX 4.14 officially supports both Linux and MacOS. So, you no longer need to apply the instructions reported here.[/box]

Being a STM32 programmer on Mac OSX, I was frustrated every time I had to launch a virtual machine running Windows only to use the STM32CubeMX tool from ST. For those of you new to this program, it's a really useful graphical tool that allows to automatically generate setup files for a STM32 MCU according the configuration we need. For example, if we have the Nucleo-F401RE, which is based on the STM32F401RE MCU, and we want to use its user LED (marked as LD2 on the board), than STM32CubeMX will automatically generate all files required to configure the MCU (clock, peripherals port, and so on) and the GPIO connected to LED (port GPIO 5 on port A on Nucleo boards).

Finally, this morning, I discovered accidentally that the latest version of STM32CubeMX tool (4.10) works perfectly on Mac, even if ST hasn't released it yet. I had tested this procedure in the past with previous release of the tool, but there were issues with the graphical MCU render. Now all seems works correctly.

So, to use STM32CubeMX on your Mac (I think that instructions works well even on Linux), ensure that you have the latest Java (release 8 update 60) installed. Then download the tool from ST website. The file is a ZIP archive. Once extracted, you'll find a file named SetupSTM32CubeMX-4.10.0.exe. This file is not a Windows PE file (the file format used by Windows executables), but it's just a JAR archive! And it's the installer that will install the tool on our Mac.

The installer need root privileges to work correctly. So, using the Terminal program, you can execute it using this command:

After a while, the setup wizard will appear, as shown below.

Schermata 2015-09-09 alle 08.10.18

Follow the setup instructions. By default, the program is installed in /Applications/STMicroelectronics/STM32Cube/STM32CubeMX. Once setup is completed, at terminal line write this command:

After a while, STM32CubeMX will appear on the screen.

Schermata 2015-09-09 alle 07.58.56

Enjoy STM32CubeMX on your Mac 🙂


You may also like

19 comments

Daniel Fauvarque September 9, 2015 - 4:01 pm

You are right, as STM32CubeMX is 100% Java code, it can run on a Mac if you explicitly call java -jar.

That said, the validation is ongoing on Linux and Mac platforms and we have found some issues in the generated configuration files for third party IDEs.

The generated code is correct but the third party IDE integration is not as plug and play as it is on Windows.

Regards
Daniel

Reply
Carmine Noviello September 9, 2015 - 4:05 pm

Hi Daniel,
Thank you for sharing this info 😉

Reply
Carlo Alberto Avizzano September 11, 2015 - 1:17 pm

I confirm,

I did a similar think last May. As a matter of fact, you may also like to install it simply as an eclipse plugin, and it will work under linux/max/win without having to do any complex install. However when coming to work you will discover that there are still different path and case errors in the include instructions/files that prevent the OSX installation to run and compile smoothly on a case sensitive filesystem.

I wrote those issues to support at ST, but as an answer I received that this type of porting is not their priority at this moment
and they will more be focused in solving issues on the target than on the host platform.

kind regards
C.Alberto

Reply
Erix September 23, 2015 - 8:08 am

Hi Carmine,

thanks for all the information you are posting!
By the way... you once said you planned to show how to setup a bare STM32 manual toolchain (gcc + make, no IDE). Any news on this front? 🙂

Reply
Strawbot October 8, 2015 - 11:51 pm

Almost works. I tried to set an input to pull down in the configuration tab by clicking on GPIO. This produced a dialog with the GPIO pins listed but when I clicked on the input I wanted to change, the bottom panel which is supposed to have the parameters in it, was a thin line. I could not access the popup selections. I had to run STMCube on Windows to change the input. But I"m hoping they'll fix it. I have the latest Java SDK (1.8) on Mac OS 10.9.5.

Reply
Carmine Noviello October 9, 2015 - 5:44 am

Yes, you are right. It seems that this is the only bug affecting CubeMX when running on OSX. I'm waiting for a next release: if the bug persist, I'll try to contact ST.

Reply
Paul D October 14, 2015 - 7:40 pm

In the past I tried patching STM32CubeMX to run on my Mac. Got close but there were too many path references that were MS Windows dependent (!). Not the kind of thing that one should do when trying to develop a multi-platform app using Java.
I was encouraged by your posting and downloaded the new build from ST. First off, the installer window was extremely narrow and it wasn't sizable (SetupSTM32CubeMX-4.10.1-RC2.exe, latest Java release 8 update 60, OSX 10.10.5). I might have been able to complete the install, none the less, but abandoned it after reading the comments here about the tool not quite working. This is the same kind of failures I have seen before with this tool when I did get it partially working. If it doesn't work 100% then same as Strawbot mentioned, I will be forced to run it in Win7 on my VirtualBox.
I've sent ST some feedback but I think that they don't take seriously just how many of us prefer to work on the Mac. So I'd suggest that anyone who is in that boat hit ST with that. Maybe they will allocate some resources to fixing STM32CubeMX so that it works right for us in addition to Windows users.

Reply
Paul D October 18, 2015 - 7:33 pm

Update: Narrow installer window issue = command line utilizes JDK, if installed, not the installed JRE version. Mine was older than rel.8,update60. Once JDK updated it worked.

New ver. of STM32CubeMX-4.11.0 is out and it seems workable so far. I did have an issue with a Makefile generator script not handling the different '/' vs '\' OS dependent path separators but that was a minor thing (ref. web site of Makefile generator: http://www.ba0sh1.com/stm32cubemx-gcc-makefile/ ). His generator works on a Mac (uses Python) even though he doesn't mention it. When using the STM32CubeMX generated project it added some offending quotation marks to the "C_DEFS =" line (in the Makefile) but otherwise it was identical to the Makefile that resulted from the Windows generated project. Note that the Makefile generator tool (https://github.com/baoshi/CubeMX2Makefile) now wants a SW4STM32 project, not a TrueStudio one.

So far STM32CubeMX 4.11.0 seems to be working on OSX for me other than the Makefile scripting issue. I'll update if I hit any snags. Hopefully others can make folks aware too if there are issues... and let ST know so that they hear from the Mac community otherwise they may think we don't exist.

I hope that this helps someone. Thanks a million Carmine for all your good work. -Paul

Reply
Fred October 24, 2015 - 12:30 pm

I guess most of you know this, but in case you don't: I tried out what happens when I change "STM32CubeMX.exe" to "STM32CubeMX.jar" and it seems to work, so I don't have to use the terminal window to open STM32CubeMX, just doubleclick.
By the way, I'm quite a beginner on this field and I am trying to set up the whole toolchain (Eclipse, arm-gcc, OpenOSD) described in the 3 blog entries on my mac (OSX 10.11.1) for a student project - is this possible in principle or am I wasting my time?

Reply
Carmine Noviello October 24, 2015 - 4:32 pm

Hi Fred,
The procedure is almost identical on the Mac. The only relevant difference is the compiling of OpenOCD, but you'll find a README.OSX file inside it. It explains all needed steps.

I use the Mac to develop STM32 applications without any problems.

Reply
Bakhtiyar November 4, 2015 - 2:04 pm

Changing the exe file to jar was really helpful step 🙂 Thanks guys.

Reply
Gideon May 7, 2020 - 5:30 pm

I tried using the command line code but it kept asking me for a password. I came across your comment and changed the .exe to.jar and it worked. Thank you both!

Reply
Fred October 24, 2015 - 4:45 pm

thanks for your reply, that is encouraging 🙂
and thank you for all your work here in the first place, I really appreciate the detailed instructions!

Reply
Leo Paesen March 8, 2016 - 9:16 am

Thanks for this, i was temped buying a PC just for STM32. You just saved me a 1500 USD.
Thanks again

Reply
Henrique February 19, 2018 - 2:16 pm

After asking for my password on the OS terminal, a message shows
Error: Unable to access jarfile /Users/admin/Downloads/SetupSTM32CubeMX-4.10.0.exe
What could I do to avoid it and install the Cube Hal correctly?

Reply
Gideon May 7, 2020 - 5:31 pm

I had the same issue. I resolved it by changing the .exe extension to .jar and installed directly.

Reply
Aymen Abderrahmen December 27, 2018 - 8:37 pm

In addition to CubeMX, STM32CubeProgrammer is available on MacOs too and it allows to program your STM32 throw STLink and Bootloader interfaces (Option Bytes programming is possible too).

Aymen Abderahmen.

Reply
Jakub Janiak July 3, 2019 - 11:18 am

And STM32CubeProgrammer has the same issue, so the solution fits.

Reply
marc November 17, 2021 - 1:19 pm

I love you, thanks!

Reply

Leave a Reply to Carlo Alberto Avizzano Cancel Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.