How To Download/Install/Run “Finite Element Method Magnetics” (FEMM) On Windows/Linux/Mac

Finite Element Method Magnetics FEMM is a free, open-source program that allows you to solve problems in electromagnetism, heat/fluid flow, etc. We will use FEMM in class to model electric/magnetic components commonly found in beamlines, e.g. magnetic dipoles and quadrupoles. The purpose of the steps outlined below is to get FEMM setup and running on your local desktop/laptop.

How To Download/Install FEMM

Windows

Installation of FEMM on Windows is easy! Here are the steps I followed to successfully download/install FEMM on Windows 10:

  • Navigate to the FEMM download page
  • Download and run the executable appropriate for your system (probably 64-bit Executable)
  • Follow the instructions on screen from the Microsoft Installation Wizard

I chose the default installation location (C:\femm42\). I was then immediately able to double-click and run the FEMM executable (C:\femm42\bin\femm.exe), no problem!

Mac/Linux

Installation of FEMM on Mac/Linux/BSD/Solaris/Etc requires one additional step compared to the Windows installation of FEMM outlined above. First, we need a way to run Windows executables without the Windows operating system – a “neat trick” to know in general! :) This is easy to do with an app called Wine. Here are the steps I followed for successfully installing Wine/FEMM on macOS 10.13.6 and Ubuntu 18.04.3 LTS:

  • Navigate to the Wine download page
  • Choose your operating system and follow the Wine installation instructions

Once you have installed Wine, you’ll be able to run the FEMM Windows executable using steps very similar to those outlined above:

  • Navigate to the FEMM download page
  • Download the executable appropriate for your system (I chose 64-bit Executable and saved the file to my ~/Downloads/ folder).
  • Open a Terminal window and run wine ~/Downloads/femm*.exe from the command line. This causes Wine to launch the Windows Installation Wizard. Neat! Now simply follow the steps on the screen….

Note: Wine may install some additional software it needs along the way, which may prevent FEMM from being installed completely on the first try. If you are prompted to install additional required software, definitely click yes/OK. If this prevents FEMM from being installed completely on the first try, simply re-run the above command, wine ~/Downloads/femm*.exe, from your Terminal’s command line.

How To Run FEMM

Windows

Double click the FEMM application. For me, this meant double-clicking C:\femm42\bin\femm.exe (since I chose the default installation location). Easy!

Mac/Linux

Tell Wine to run the FEMM Windows application. For me, this meant opening a Terminal window and running the following command from the command line:

# Run a Windows executable on Mac/Linux using Wine!
wine ~/.wine/drive_c/femm*/bin/femm.exe  # ... or wherever you installed FEMM

For Mac/Linux user’s, notice the directory structure setup by Wine closely resembles that of Windows, e.g. ~/.wine/drive_c on Mac/Linux resembles C:\ on Windows. This mnemonic may help you navigate the file hierarcy.

Try loading an example

FEMM ships with several examples, which you should now be able to run. If you chose the default installation location, like I did, you should be able to navigate to the following folder and double-click on any example:

# Here is where the FEMM examples are kept on your local machine
C:\femm42\examples  # Windows
~/.wine/drive_c/femm42/examples  # Linux/Mac

If you double-click on an example, you should see the raw geometry of the problem loaded in FEMM. We’ll talk about how to “mesh” and “solve” the problem in class, as well as how to extract meaningful results using the FEMM “inspector”. Notice the examples in the directories listed above correspond to the examples found at the FEMM website. This is a great resource if you’d like to try an example or if you forget how to setup a problem in FEMM in the future!


  1. Northern Illinois University