Saturday, November 3, 2012

How To Create a PyCharm Launcher on Ubuntu 12.10

I'm absolutely loving using PyCharm for my Python and Django development, but one of the lingering things I've been meaning to nail down once and for all is creating a launcher for PyCharm in Ubuntu 12.10. Despite the automated way you can attempt to do this from within PyCharm itself and all the other recommendations I've read I was unable to get it working.

In the mean time I also bought of copy of IntelliJ IDEA when they had some crazy back to school sale a couple of months ago (I still dabble in Groovy and Grails a bit). I was having the same issues with creating a launcher for IDEA and the typical tricks I use for Eclipse weren't working, but luckily I came across this post that explains how to do it. The only change I made is pointing to idea64.vmoptions instead of just idea.vmoptions -- other than that it works great.

That got me thinking -- since PyCharm and IDEA are both made by JetBrains, and both run on Java, chances are how they work is pretty darn similar. So I decided to copy the IDEA launcher script and modify it for PyCharm, and lo and behold it worked!

Here's my modified version of the IDEA launcher that works for PyCharm.


export JAVA_HOME=/opt/java/jdk1.7.0_09
export JDK_HOME=/opt/java/jdk1.7.0_09

export PYCHARM_HOME=/home/mwoodward/pycharm-2.6.2

export PYCHARM_VM_OPTIONS="$PYCHARM_HOME/bin/pycharm64.vmoptions"

cd "$PYCHARM_HOME/bin"


Obviously adjust all the paths as necessary for your machine. Make sure you chmod +x on the file, and with that in place you can open up Main Menu (sudo apt-get install alacarte if you don't already have it installed) and add a launcher. For reference the icon lives in PyCharm's bin directory.

Hope that helps someone else who has run into this issue.