Sublime Text not showing in Nautilus "open with" menu

Solution 1:

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

Solution 2:

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.

Solution 3:

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!:)

Solution 4:

Do this only if you installed sublime text using 'Ubuntu Make'(umake). Ubuntu Make(umake) makes installing and updating developer tools easier. Type this in terminal.

cat ~/.local/share/applications/sublime-text.desktop

Contents of sublime-text.desktop file will be displayed. Note the following line in the file:

Exec=/home/ja9/.local/share/umake/ide/sublime-text/sublime_text

You need to change that line. Type:

sudo nano ~/.local/share/applications/sublime-text.desktop

The nano text editor is opened, edit that line to

Exec="/home/ja9/.local/share/umake/ide/sublime-text/sublime_text" %F

Make sure you typed capital F, not small. Press 'Ctrl+O'. Press 'enter'. Press 'Ctrl+X'. Type:

sudo update-desktop-database

Problem solved :) , if not, restart system. Note: nano is very good for editing, give it a try(tries)