Sublime Forum

Oops... my 'subl' executable file is empty... what did I do / how do I fix it?

#1

Hi. I was trying to run sublime from the command line after a long time not doing so, when I found that trying to execute

/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl

from the command line no longer worked, though that path was still in my file system. Taking a look, I found that the above file was empty. No wonder.

I don’t know how I wiped that file. Anyway, I can start up Sublime via my gui, so the executable is still in there somewhere. How do I repair the situation?

0 Likes

#2

That looks like the correct path; if the file is empty you should be able to re-download the version of Sublime that you’re using and overwrite the one that you already have. Your configuration information and setup is not stored inside of the application directory, so you won’t disrupt anything by doing so.

0 Likes

#3

OK. But this file is supposed to contain the full binary?

My Sublime is running, so the executable is obviously somewhere. I can’t re-create a hard link, or something?

0 Likes

#4

What you should be creating is a symlink to the binary; depending on the tools you’re using they might follow the link (in which case you’d open the executable) or they might open the link (in which case you might just see the name of the file the link points to, or such). That presumes you made a soft link, though; if you made a hard link then the two files both refer to the same thing on disk.

subl is the name of the command line helper that talks to the full application; the binary for Sublime itself is a different file. So even if subl is missing, Sublime will still work.

0 Likes

#5

OK; is there anywhere I can find/install the ‘subl’ helper on its own, or should I just reinstall sublime?

For the reinstall: Is it really as simple as dragging a newly downloaded “Sublime Text.app” into the Applications folder? That won’t erase any of my settings/plugins/tweaks-i’ve-made-to-plugins/whatever?

0 Likes

#6

As far as I’m aware, it’s only a part of the Sublime app bundle, so apart from re-installing the App the only other way to get it would be to download the latest version of the app, look inside of it and copy the file out, but that’s more work than just reinstalling.

Packages in Sublime are stored in three places; inside of the installation location of Sublime itself (the packages that ship with Sublime and are common to everyone that installs Sublime), the Installed Packages folder (which contains sublime-package files for packages installed by Package Control) and the Packages folder (which contains folders and loose files for packages); this is covered in more detail in this video as well.

Your customizations to Sublime (preferences, key bindings, and package settings) are stored in your User package, which is stored in the Packages folder.

If you use Sublime Text > Preferences > Browse Packages from the menu, it will open the Packages folder in Finder. In doing so you’ll see that this is actually stored in your home directory and not inside of the Applications directory; that’s specifically so that you can reinstall Sublime (and so that it can upgrade itself by replacing the application) without disrupting your settings. It’s also the reason why reinstalling Sublime in order to fix problems generally has no effect on anything at all, because most problems are related to packages that you’ve installed and upgrading Sublime doesn’t touch that.

It’s technically possible to set up a portable build of Sublime on MacOS (Windows is the only version that is distributed that way out of the box), in which case the configuration is stored inside of the Application folder.

In any case, if you’re in doubt use the menu command above and go up enough levels to be able to get to the parent Sublime Text 3 folder, and make a backup of it; you could then put it back if anything goes wrong.

0 Likes

#7

OK. I took the leap of faith simply moved the new ‘Sublime Text.app’ into the Applications folder, after doing a backup of my Packages folder.

Everything seems to be working as before, and the command line is repaired.

Sorry for making you type all that :confused:

1 Like

#8

Haha, no worries. Caution is important; it can stop a lot of unpleasant things from happening when you least expect it. Glad you got it all sorted out!

0 Likes