Installing Intellij IDEA on Mac and Ubuntu

It has been a year since I moved my professional and community development projects from Netbeans to IntelliJ IDEA. Netbeans is still a great IDE and I recommend it over any other open source alternative, but the productivity brought by IntelliJ is so great that the time I’ve saved using this IDE already paid off.

I have IntelliJ installed at home and at the office. It’s the same license but the deal is: you can install it in several computers but use one installation at a time. I use Mac and Ubuntu at home and my experience installing IntelliJ in those platforms was the following:

Installing on Mac

I’m not really going into step by step here. IntelliJ is pretty easy to install on Mac, but I had a problem with the JDK and I’m going to focus on that now. IntelliJ uses the JDK distributed by Apple by default, which is a JDK 6 implementation. Well, this is not a big deal, since we can install the most recent JDK and configure our projects in the IDE to use it instead. But, for some unexplained reason, I couldn’t configure the IDE to start the application server in a JDK different from the one used by IntelliJ (JDK 6). In the image below, you can see I’ve configured JDK 8 to run WildFly, which requires JDK 7 or superior, but it didn’t work.

wildfly-configuration

So, I had to change the JDK used by the IDE. For that, I:

  1. closed IntelliJ;
  2. went to the folder where all applications are installed (/Applications) and selected the file “IntelliJ IDEA ##.app”;
  3. accessed the context menu (mouse click with two fingers) and selected “Show Package Contents”;
  4. opened the file “/Contents/Info.plist” and
  5. located the JVMVersion to change its correspondent value to 1.8*.

After this configuration, I could finally make IntelliJ run Wildfly.

Installing on Ubuntu

The installation on Linux is traditionally more complicated. I wonder why people complain about the low number of Linux desktop users. đŸ™‚ The IntelliJ IDEA download page mentions only two steps:

  1. unpack the “ideaIU-XX.Y.Z.tar.gz” file using the command “tar xfz ideaIU-XX.Y.Z.tar.gz” and
  2. run “idea.sh” from the bin subdirectory.

However, this instructions don’t deliver IntelliJ as delivered in other platforms. People don’t go to the installation folder and execute the file idea.sh. They either create a desktop icon or add the bin directory to the path, but these steps are missing. So, in my understanding, the installation is not completed. To launch IntelliJ from anywhere in the command prompt:

Become the root user:

sudo -i

Move the unpacked folder to “/opt/idea”:

mv ideaIC-XX.Y.Z /opt/idea

Edit the file .bashrc:

gedit ~/.bashrc

Add the following line to the end of the file:

export PATH=/opt/idea/bin:$PATH

Log out and log in to the change take effect.

To add the launcher icon on the desktop, there is a soft and a hard way.

The Soft Way

Fortunately, IntelliJ can help you once you run it for the first time. In the welcome window, select “Configure”:

intellij-configure

And then select “Create Desktop Entry”.

intellij-configure-desktop-entry

That’s it!

The Hard Way

As a good Linux user, you may prefer doing it the hard way, as follows:

Create a desktop file:

cd /opt/idea
gedit idea.desktop    

Copy the content bellow to the file:

      [Desktop Entry]
      Name=IntelliJ IDEA 
      Type=Application
      Exec=idea.sh
      Terminal=false
      Icon=idea
      Comment=Integrated Development Environment
      NoDisplay=false
      Categories=Development;IDE;
      Name[en]=IntelliJ IDEA

Install the desktop file:

desktop-file-install idea.desktop

Create a symlink:

cd /usr/local/bin
ln -s /opt/idea/bin/idea.sh /usr/local/bin/idea.sh

Finally, display the idea icon in dash:

cp /opt/idea/bin/idea.png /usr/share/pixmaps/idea.png

At this point, you will finally feel IntelliJ as an application, integrated with the desktop and always ready to be executed.

11 thoughts on “Installing Intellij IDEA on Mac and Ubuntu

  1. Hi, I followed “The Soft Way.” But now I don’t wanna use the IDE; I will stick to NetBeans and Eclipse rather. I uninstalled the same by removing it from /opt and from my home (.Idea). The problem is the launcher that it produced still appears on dash menu and under Programming of ClassicMenu Indicator (a menu similar to old Gnome, installed to easily open apps). I’ve searched it also in /usr/share/applications to no avail.

    May I add? As for NetBeans, I manually created its launcher and put in /usr/share/applications. It’s working ever since. As the launcher has something like “Categories=Development;IDE;”, it’s appearing under Programming. I’m okay with that. But recently, I found out that the launcher has been included under Other of ClassicMenu even though I never changed the launcher. Similar to Idea, I can’t find the launcher file in /usr/shares/applications (I’m sure I placed it here.)

    They also are nowhere inside ~./.local/share/applications.

    Hope you can help me. Thank you.

    1. I’m not sure what is exactly your question. I’m using Ubuntu + Unity, not Gnome. And I don’t use Netbeans neither Eclipse.

  2. I tried to install this on Ubuntu, and…
    When I extract the .tar.gz file and go into the bin folder and click on idea.sh, i get the message while the ubuntu software center opens up.
    “Error
    //longFilePathName// could not be opened”

    Any ideas on how to solve this?

    1. Use the Terminal to execute sudo ./idea.sh should work. Usually if you just doubleclick it a textfile will be opened.

      1. Actually, to use ./idea.sh we have to navigate to Intellij IDEA directory to find the script idea.sh. Usually, we can simply type idea.sh anywhere in our command line to run the IDE, but it this case it makes that terminal window useless. So we have to add “&” to run Intellij IDA in a separate process: idea.sh &. It leaves the terminal available for other uses, but the print outs of the IDE bother a lot. That’s why I decided to use a desktop entry.

  3. For linux, why install in a folder inside the opt folder?

    I have it installed in my home directory, I can see it getting messy with everything, but I’m a novice linux user.

    1. Because it makes Intellij IDEA available for multiple users in your machine. In a home directory it is available just for one user.

  4. After copying the idea folder to the opt folder, you might need to change the path in the idea.sh. At least it was necessary for me to be able to run idea from anywhere.

Leave a Reply

Your email address will not be published. Required fields are marked *