Saturday, May 21, 2011

Installing MPLABX on Ubuntu 11.04

As promised these are the instructions for installing MPLABX on Ubuntu Linux. Nothing is really too tricky just a few gotchas along the way that hopefully these instructions will help you avoid. These instructions were performed on a fresh install of Ubuntu 11.04 but they should work on previous versions of Ubuntu and even other Linux distros. If you know of differences or tips for other environments please send them in and I'll post them here. NOTE: These instructions pertain to a 32-bit installation of Ubuntu.

Get the Files

Before we do anything we'll need the files from Microchip. Go to and accept the license agreement and you'll be taken to the download page.
  1. Select the platform of Linux
  2. Select the items you want to download and install. I chose:
    • MPLAB C18 Lite Compiler for PIC18 MCUs
    • HI-TECH C Lite Compiler for PIC18 MCUs
    • HI-TECH C Lite Compiler for PIC10/12/18 MCUs
  3. Click Download Now and it will start 4 separate downloads.

Install Java

MPLAB X requires Java to be installed in order to run. To install Java in my Ubuntu environment I ran the following commands from a terminal window. You can find the full instructions at

sudo add-apt-repository ppa:ferramroberto/java

sudo apt-get update

sudo apt-get install sun-java6-jre sun-java6-plugin sun-java6-fonts

With java installed we can begin installing pieces of MPLAB. I decided to install the compilers first but don't know if that's required.

Open a terminal window and browse to the folder where you downloaded the MPLAB files. Before you can run any of the installers you will need to verify that they have execute permissions. Execute the following commands in the terminal window:

chmod 755 mplabc18.bin

chmod 755 mplabx-ide-beta60-linux-32-bit-installer.bin

chmod 755

chmod 755

Install the Compilers


Enter the following command:

sudo ./mplabc18.bin

An installer will launch. Follow the prompts through. Nothing special here.


sudo ./

This is a more traditional linux install script and will have you read the license agreement in the terminal window. Hit enter to scroll down through that and accept it at the end.

After the license agreement it will ask you where you want to install the compiler and suggests a path of /usr/hitech/picc-18/pro/9.63PL3. I didn't feel like I needed the pro layer in there so I just used /usr/hitech/picc-18/9.63PL3. It will then prompt you to enter the serial number, "demo", or "lite". Type "lite" and hit Enter. The install will finish.

HI-TECH for other PICs

sudo ./

This install is practically identical to the one for PIC18 devices. The only thing different is the install path. I used /usr/hitech/picc/9.80a. You're free to use whatever you want. Now that the compilers are installed we're ready to install MPLABX.

Installing MPLABX

From the terminal window run:

sudo ./mplabx-ide-beta60-linux-32-bit-installer.bin

An installer will launch. I accepted all of the defaults and let it install. When it's done you will get a message saying you will need to reboot your system for the changes to take affect. In reading the Microchip forums this was suggested because certain USB programmers may not work until you do so. However, I was able to do:

sudo restart udev

and have MPLABX correctly recognize my Pickit 3. You may or may not need a reboot.

With MPLABX installed we need to make it aware of the HI-TECH compilers. For some reason it recognizes C18 right out of the box but not the HI-TECH ones.
  1. Launch MPLABX
  2. Go to Tools->Options
  3. On the Build Tools tab click Add under the Toolchain box.
  4. Browse to the path of the compilers and MPLABX should detect them. I was not able to get it to recognize the PICC-18 compiler. If anyone has any luck with that let me know.
Once that is finished we are ready to test things out. I was fortunate because I have two projects out on github that I could pull down and use for testing. One will test that the C18 compiler is working correctly and the other will test the HI-TECH compiler for non-PIC18 devices.

If you don't have git installed I suggest you do that now. I won't cover the instructions for that here because there is no lack of documentation for it online. Just google "install git on Ubuntu."

Compile EmbeddedFun

The EmbeddedFun project uses the C18 compiler so we can use it to test whether everything is set up properly. Pull that project down from github into a directory of your choosing.

git clone<username>/EmbeddedFun.git

I've already updated the project to follow the new MPLABX layout of files. There are no longer .mcp files with MPLABX and builds are done with makefiles.
  1. Launch MPLABX.
  2. Go to File->Open Project
  3. Browse to the firmware folder of the EmbeddedFun project and select the make object and click Open Project
  4. Test your installation by performing a "Clean and Build" action.

Compile FMBomb

The EmbeddedFun project uses the C18 compiler so we've tested the installation of that but we haven't tested the installation of the HI-TECH compiler. Well, we're in luck because that's what the FMBomb project uses so let's pull that project down.

git clone<username>/FMBomb.git

Open the FMBomb project in MPLABX.

One thing I had to change in the Project Properties to make the HITECH compiler work was to remove the PRO option. To do so select your project in MPLABX and go to File->Project Properties. Expand the Conf: [default] section and the HI-TECH PICC section and select Compiler. Select Operation from the dropdown and change the Operation Mode to "Lite".

Now try to build the project. Everything should be working and you should be all set to create your own projects.


  1. I'm also getting ready to install MPLAB X on Ubuntu 11.04 right now so thanks for the post.

    Is your USB programmer working? Everywhere else I have read seems to indicate that you need the 32 bit version of the JRE to get the programmers to work. It seems however, that you only installed the standard 64 bit version or are you running this on a 32 bit install of Ubuntu?

    I was actually searching for the best way to install the 32 bit version of Java on a 64 bit system when I came across this post.


  2. I actually did a straight 32 bit install of everything. Thanks for pointing that out, I'll update the post to reflect that. Unfortunately that means that I can't offer much help on the 32 bit JRE situation. My Pickit3 is working great with the 32 bit setup though. When you figure it out send me a note and I'll post the info here.

  3. Okay, as with a lot of things, this turns out to be much easier than I had originally feared it would be once I figured everything out.

    First, you need to install the Sun(Oracle) 32bit JRE. This is assuming a you have a 64bit install of 11.04 and so some 64bit JRE installed. There is actually already a package to do this. In Synaptic Package Manager type "sun-java6" in the quick filter field. The package you want is the ia32-sun-java6-bin so, select and then install this package.

    The second part is configuring MPLAB X to use the 32bit JRE instead of the system default Java which you will want to leave set to a 64bit JRE. (Use "sudo update-alternatives --config java" to set the default.) The hint for this part came from:

    For Ubuntu and the ia32-sun-java6-bin package we need slightly different paths than shown. So, create a shell script that contains the following:


    Then make it executable and change the launcher to point to this script.

    MPLAB X now sees my ICD3.


  4. Awesome, thanks for the info. I'll add it to the post. Glad you got it working.

  5. I've installed mplabx on ubuntu 11.04 but when I try to build my project I got this error:

    Error: File not found - /opt/microchip/mplabx/mpasmx/

    I didn't install any C compiler since I do not need it. Currently I am using mpasmx since I need work with assemble code.

    Does anyone have a clue of what's going on here? Thanks.

  6. irving, not sure how helpful this would be but I found this. Seems like a missing file is causing the error. If you find an answer post it here in case others are having similar issues. Thanks.

  7. Thanks a lot K-Sid!! I can finally develop codes with pickit3, although I have MPlab Beta 7.12 .

    Good tuto!

    I know it is probably too late but for Irving Vladimir, try to download MPLAB C18 Lite Compiler for PIC18 MCUs then install it somewhere on your computer. Take the and paste it in your /opt/microchip/mplabx/mpasmx/ . Or install directly MPLAB C18 Lite Compiler for PIC18 MCUs in your /opt/microchip .

  8. Thanks for the comment and thanks for the tip on irving's post.


Keep it clean and civil. That's all I ask.