Sublime Text not showing in Nautilus "open with" menu

Copy the contents of /usr/share/applications/sublime_text.desktop to ~/.local/share/applications/sublime_text.desktop

Or simply use:

cp -it ~/.local/share/applications /usr/share/applications/sublime_text.desktop

Then in the terminal type: sudo update-desktop-database


In case an old cache does something wrong, simply delete it and let a system make new one for you.

rm ~/.local/share/applications/sublime_text.desktop

It works for me.


I tried all the options as mentioned in other answers. But, somehow it didn't help me (I'm using Ubuntu 16.04 and installed Sublime-text_build-3126_amd64).

I see this problem occurs in my system only when I install Sublime editor using the package (sublime-text_build-3126_amd64.deb) downloaded from the site. However, installing Sublime from terminal resolves this problem.

I'm yet to figure out technically why there is a difference in the application behaviour between its 2 modes of installation. However, as it works for me, am sharing it here so that it might be helpful for others. The working alternative is:

  1. Uninstall the existing sublime package. Use Synaptic Pkg Mgr and do a complete removal.
  2. Install sublime using the commands:

    For Sublime-Text-2:

    sudo add-apt-repository ppa:webupd8team/sublime-text-2
    sudo apt-get update
    sudo apt-get install sublime-text
    

    For Sublime-Text-3:

    sudo add-apt-repository ppa:webupd8team/sublime-text-3
    sudo apt-get update
    sudo apt-get install sublime-text-installer
    

    Enter subl command to begin instantly.

  3. Right-click on the file you wish to open in the Sublime editor. Now, you could find the application "Sublime text" listed in the menu. Also, you could set the editor as default for the file-type by setting it in the file's properties.

Thanks!:)