Running Multiple Instances of the MPLAB® X IDE

Last modified by Microchip on 2023/11/09 09:11

Setting Up Hardware Tools to Work with Multiple Instances

By default, you can work with up to five instances of the Integrated Development Environment (IDE). If you want to have more instances, you will need to modify the “mchpdefport” file manually.

Some setup is required before using hardware tools (PICkit 5, etc.) with an instance of MPLAB® X IDE. After any hardware tool setup, an instance of the IDE may be invoked from its own directory.

Use and Format of the “mchpdefport” File

The “mchpdefport” file provides the information necessary for tool hot-plug use to both the IDE and to the low-level USB library (DLL, so, or dylib file). The format for this file is as follows:

localhost
30000
30002
30004
30006
30008

The first line indicates the host name on which the IDE is running.

The other lines represent port or socket numbers through which the low-level library communicates with the upper-level IDE. Each instance of the IDE will be assigned to a different port or socket. All communications between the instances of the IDE should be hidden from the user.

For up to five instances of MPLAB X IDE, you do not need to alter this file. If you want more than five instances, you can edit the file to add more port or socket numbers.

Location of the “mchpdefport” File

Within a default installation of the IDE, the “mchpdefport” file can be found in the following place, depending on the operating system:

OSLocation
Windows (64-bit)

C:\Windows\system32
and
C:\Windows\SysWOW64
(Note: Both occurrences of “mchpdefport” must be modified.)

Windows (32-bit) C:\Windows\system32
Linux /etc/.mplab_ide 
Mac (OS X) /etc/.mplab_ide 

Invoking Instances of the IDE

MPLAB X IDE requires that each instance has its own user directory. Therefore, preferences that are set or plugins that are added to one instance will not be reflected in another instance.

In order to invoke multiple instances, launch the IDE with the --userdir option and specify a directory.

Windows® OS

1. Create a shortcut with the --userdir option. For example, on Windows 7 OS:

1. Right click on the desktop and select New > Shortcut.
2. Browse to the installed MPLAB X IDE executable, by default at: C:\Program Files (x86)\Microchip\MPLABX\vx.xx\mplab_ide\bin\mplab_ide.exe where vx.xx is the MPLAB X IDE version.

3. At the end of that line, type the location of the user directory. You can either place your directory under the default location for this type of MPLAB X IDE information:

--userdir "C:\Users\MyFiles\AppData\Roaming\.mplab_ide\dev\anydir"

or you can place it where ever you like:\

--userdir anydir

4. Click OK.

Linux® OS

The installed version, run without any parameters (clicking on the desktop icon), will run with a user directory of $(HOME)/.mplab_ide. To change the user directory, run the $InstallationDir/mplab_ide/bin/mplab_ide shell script, passing the argument --userid anydir. For example, to run MPLAB X IDE in two different instances:

$ /opt/microchip/mplabx/vx.xx/mplab_ide/bin/mplab_ide --userdir ~/.anydir1 &
$ /opt/microchip/mplabx/vx.xx/mplab_ide/bin/mplab_ide --userdir ~/.anydir2 &

where vx.xx is the MPLAB X IDE version.

You can create desktop icons that have the user ID embedded, too.

Mac OS®

Open a Shell window and type a command line listed below to execute your installation of MPLAB X IDE in an alternate user directory. You can either place your directory under the default location for this type of MPLAB X IDE information:

$/bin/sh /Applications/microchip/mplabx/vx.xx/mplab_ide.app/Contents/Resources/mplab_ide/bin/mplab_ide --userdir "${HOME}/Library/Application Support/mplab_ide/dev/anydir"

or you can place it wherever you like:

$/bin/sh /Applications/microchip/mplabx/vx.xx/mplab_ide.app/Contents/Resources/mplab_ide/bin/mplab_ide --userdir anydir