Difference between a stand-alone executable file, and an installed executable?

17

2

I have noticed on Windows, at least, that you can download a direct, statically-linked executable file and launch it directly, or write your own program and executable it (even dynamically) without having to install it.

That brings me to my main point ... what's the purpose of the installation process? I mean besides maybe the Windows Registry. However, for practicality and usage purposes, it's possible to have a single, independent, stand-alone program that can be run, stored on non-volatile storage, and accessed via the filesystem of whatever device it's on, and executed on the OS. So what's the big deal with all this "install this" business if many a great programs of virtually any magnitude can work perfectly without going through an installation configuration? It puzzles me a bit, and aside from a database or other metadata/access configuration systems, what is the real difference here if the latter(an installed executable)performs and works in the same way as a stand-alone?

Is there a difference here I'm unaware of with a non-installed program versus an installed one?

PS: This doesn't just have to apply to Windows OSes, but any that implement a similar function.

user279884

Posted 2013-12-06T21:38:46.950

Reputation:

Answers

16

There are several reasons why programs come as installers rather than standalone executables:

File Size Concerns

  • Programs with many, large dependencies can bundle Web-based installers that download the dependencies and place them in a common location, so that they can be shared by multiple programs. For example, DirectX is a very large library. If every single program on your system that depends on DirectX just bundled the entire DirectX runtime with it, it would consume a good bit of space. This may not seem to matter in the age of 4 TB hard disks, but consider that SSDs are quite a lot smaller in capacity, and they're coming into common use on ultrabooks, some with as little as 64 GB of storage. And of course there are many other shared libraries aside from DirectX.

  • Programs that are both very large and continuously updated are best distributed as a collection of many small files, along with a launcher or updater program that checks the Internet for an update, and if any update exists, only download the required changes. If all large programs were shipped as a single monolithic executable, it is very likely that the patch process would require re-downloading the entire executable, as patching the running executable file on disk is near impossible due to file locks. Also, because the updater needs to know where its files are, it often stores that directory path in a well-known location in the registry.

User Convenience Concerns

  • Installers for very large programs, such as Visual Studio and Microsoft Office, allow the user to de-select the installation of certain features, if the user knows they will never need them. This has 3 potential benefits: it reduces disk space consumption; it can reduce download time and bandwidth consumption if the installer is a web downloader; and it can reduce "clutter" and "bloat" on the user's machine, fewer start menu / desktop shortcuts, fewer startup programs, etc.

  • Installers for complicated programs often come with configuration options that the user can set up using a user-friendly graphical interface as part of the installer. See for example the MySQL or SQL Server installers, which can take you through the entire process of getting your database server up and running before you even click "Finish" on the installer.

  • Installers can prompt the user for required information, such as license keys, which only need to be entered once. This can simplify the design of the program itself, and reduce the number of things it has to do and check for when it starts up. This also results in the user having confidence that, once the program is successfully installed, it should "just work" -- there are no more "gotchas" within the program that may hold them up from using it.

Compatibility Concerns

  • Some programs conflict with other programs. This is a simple and unfortunate fact of software engineering. Before installing a program that has known conflicts with other programs, it is often helpful to first check the system to see whether an incompatible program is installed. The user can then be alerted if so. For example, there is a very dangerous incompatibility potential in older versions of VMware and VirtualBox, that resulted in a Blue Screen of Death, because one program would try to use a special virtualization processor instruction after it was already reserved for user by the other product. If you were to simply provide the end product to the user without an installer, you would have to check for the presence of incompatible products at every start of your program, which could slow down the startup of the program.

  • Programs may have dependencies on other system components that can only be installed at a system-wide level, not at a per-user level. In order to install these special system components, administrative privileges are usually required, and an installer usually has to be run.

Elevated privileges and special services

  • Some programs depend on changes to the operating system for their functionality, and these changes can't easily be implemented without some kind of installer to take care of them with administrative privileges. For instance, programs that install drivers or kernel modules, such as Wireshark, can't simply be run, because you absolutely have to ship the kernel-mode components in separate files. In the absolute best case, you would still have to have the user manually unzip an archive, and then run some kind of installer for the device driver. Services are another example of something that requires administrative privileges to install. Installer software is particularly good at obtaining admin rights in an elegant way, without requiring that the main program itself request admin rights every time it runs (this would be an unnecessary security exposure in many cases).

Having given all these reasons for why installers are useful, here are a few observations from the other side:

  • Many programs, even those that are only available for download as an installer that requires admin privileges, can be forcibly "unpacked" from their installers and run directly without installing them. Other programs, especially open source ones, are repackaged into self-contained executables by PortableApps. It is noteworthy that some programs, when unpacked from their installer, will have reduced functionality, exhibit errors, or other problems.

  • On operating systems other than Windows, it is almost always possible to simply download (or compile) programs and run them as a regular user, without obtaining root. There are a few exceptions with respect to packages that are a core part of the operating system, but for most user applications, you can run it in your home directory without installing it system-wide using the package manager. Windows is a bit of a special case in that most desktop programs on Windows have an installer, and can usually not be installed any other way.

  • Even on non-Windows platforms, programs that need the ability to load a kernel module come with some sort of installer, which compiles the kernel module and installs it in the right directory. You can also expect to see an installer in the event that the program is a daemon that will be started using a system service script, e.g. in /etc/init.d. This type of "shrinkwrapped binary" is a less common distribution method on GNU/Linux, but most Linux distributions still provide most software in the form of installable packages, each of which requires root access (admin access) to install.


Conclusions

You asked why we need installers. The short answer is that we don't -- not strictly speaking, anyway. There are vanishingly few examples of applications that cannot, in principle, be bundled into a single self-contained executable with no resources, no installer, etc. Even something as complicated as VMware Workstation could automatically obtain admin privileges, write the hypervisor kernel module out to a file on disk, and install it dynamically on program startup, and ship all of its resources (images, sounds, etc.) bundled inside the data section of the executable.

Using an installer or not is a choice that software producers have to make. There are advantages and disadvantages to using an installer. Many vendors choose to distribute their software both as an installer, and as a standalone binary, or at least as a ZIP file that can simply be unpacked and run. For software that does not absolutely require an installer, this is a very pragmatic way to go, and makes everyone happy. Usually, software that does not ship in any other form than with an installer is software that requires administrative privileges to install some component of itself, since the installer is the most elegant way to obtain the needed privileges.

Personally, I find installers very annoying in my day to day work, because sometimes I want to run a program when I don't have administrative rights on the computer I'm using. I have quite a bit of experience manually unpacking installers to extract the program files within, and then getting those files to run correctly. However, on my personal PC at home where I always have administrative access, I find installers beneficial and convenient, because most installers give me useful options, like whether to create a desktop shortcut, that I would have had to do manually instead without it.

allquixotic

Posted 2013-12-06T21:38:46.950

Reputation: 32 256

Great answer, but your opening with DirectX and runtime doesn't make sense. First off, DirectX's only runtime is within the language it is written in itself, which is C. – None – 2013-12-06T22:10:31.603

@TomTurkey Um... what? Why does it matter what language it's written in? Sure, you could statically link any DirectX components that you need straight into your executable, but like I said, that presents a file size problem if many programs start doing this with large libraries (Qt 4.x, for instance, runs about 40 MB). The code has to be somewhere, and you can't just assume that the DirectX version you need is already installed on the system, or you'll get an error when someone opens your program on Windows XP SP2 that hasn't been patched in ages. – allquixotic – 2013-12-06T22:20:47.050

4Oh, I think you misunderstood me -- in my answer, I wasn't talking about installing DirectX itself; I was talking about installing a program that depends on DirectX. To satisfy that dependency, you can either compile DirectX directly into your application, thus increasing wasted disk space consumption, or you can bundle a little app in your installer that checks whether you have the appropriate DirectX runtimes installed, and if not, downloads them and puts them in a centralized system location. The latter is much more efficient in terms of disk space and download size. – allquixotic – 2013-12-06T22:24:48.163

3@allquixotic Also, licensing. Sometimes, a library may not be licensed for reditribution independent of its installer. DirectX may fall into the category, I'm not sure. The .NET framework does, I think. It's not a technical restriction, but a legal one. (The .NET framework has additional technical restrictions, though. It's pretty tightly integrated into the OS.) – Bob – 2013-12-07T06:58:04.580

1boop. The sound of an upvoted comment. In my head. – allquixotic – 2013-12-07T08:33:03.870

@allquixotic I'm pretty sure you can't statically link to DirectX runtime because it's a set of COM interfaces. And the runtime itself is deeply integrated with the OS. So using an incompatible version of DirectX linked right into the executable can lead to app/system crash. DirectX falls into .NET framework category where your only option is to redistribute the original installer of DirectX. – Alexey Ivanov – 2013-12-07T12:41:17.957

@AlexeyIvanov True, COM is a special case; in order to avoid installing DirectX using the proper installer, you would have to embed the DLLs in your EXE, then extract them to disk at runtime into a temp folder, and use registrationless COM to interface with them. Or register them into HKCU and use them that way. – allquixotic – 2013-12-07T22:25:27.267

3

The installation process considers these items:

  1. whether you have required library (api) installed, such as .net framework version, or direct X.

  2. Install some extra system DLL files into system folder. If system folder already contains these files (same version), then ignore this step. This way you don't need several copies of the same DLL files.

  3. Install shortcuts into your Start menu or Desktop to help you start the application quickly.

  4. As you said, Registry modification. This step can actually be done when the application is first executed in this computer, so it is not extra important.

  5. very important: whether to bundle a software (such as Google desktop bar or Yahoo! bar into your IE). This is the way a lot of independent software creating revenue to the developer. Don't forget that, if you are using free software.

Because we are considering an "executable" application, we don't need to discuss those steps that can install a IE add-on or related things.

Ben Lin

Posted 2013-12-06T21:38:46.950

Reputation: 271

3

Stand-alone program has no external dependencies.

It doesn't have to be .exe file only, it can have accompanying libraries and data files: Unpack the archive to a folder and run the executable. If you just unpack an archive, no shortcut is added to Start menu, hence you'll have to navigate to the folder where the unpacked application is located and start it from there, or manually create a shortcut for it in Start menu. Many computer users find it difficult.

Easier to Use

An installer guides users through the installation process. You download the installer, .exe or .msi (the former is preferable for non-advanced users), and run it. It picks up the installation folder, usually in Program Files, copies the files, creates shortcut in Start menu. You're done: in the majority of cases you simply click Next several time.

Then go to Start menu and run the application. Some installers provide an option to start the application when installation is complete.

If the application opens files or documents of certain type, the installer registers it with the shell. So that you can click the file to open it.

License Agreement

Many applications, both commercial and free ones, require you to accept the license agreement before you can use their application. Installation doesn't proceed until you acknowledge you agree to the license terms. Even if you didn't read the license, you have agreed to it.

Dependencies

Sometimes it's not enough to simply copy the executable files. Applications often use shared components or special runtime libraries. For example, .Net framework runtime has to installed to run the application written for .Net; even Visual C++ runtime, if it's not statically linked, has to be installed. The installer takes care of ensuring all the dependencies are satisfied.

If an application consists of several .exe and/or .dll files, dynamic linking to Visual C++ runtime reduces disk space. If .exe and .dll are statically linked, then the runtime is duplicated in each and every file.

License terms of a library may not allow statical linking.

Security

If a vulnerability is found in the runtime, it can updated separately from the application. Updates to .Net and Visual C++ runtime are installed automatically via Windows Update.

If executables and libraries are statically linked, then application vendor has to recompile the application and release the updated version. So using shared runtime reduces cost of application maintenance for developers and vendors.

Installing to Program Files also provides more secure environment: the files there can't be modified or deleted without administrator privileges.

Registry

Many Windows applications rely on entries in the registry. If application uses COM, all the objects have to be registered otherwise the application will fail to create the needed object and will not start.

Alexey Ivanov

Posted 2013-12-06T21:38:46.950

Reputation: 3 900

1+1 for security updates to shared components -- I didn't think to write that in my answer. – allquixotic – 2013-12-07T22:32:53.973

0

Brief answer: a stand-alone exe requires no libraries be installed on the computer to run, and requires no registry entries or other components.

An installed file can be a stand-alone in an installer package, but is generally dependent on a variety of components and libraries installed alongside it.

In many cases, through Universal Extractor (unofficial update: here), you can extract the contents of an installer and run a program without administrative privledges in windows. MSI installers can be unpacked with lessmsi.

In most other operating systems, all programs can be run without root/administrator privledges, through user-specific 'bin', 'lib', and other directories in the home directory. Personally, I despise installers the majority of the time, because they make it harder for me to use programs with out administrative privledges when I don't have them. But they are packaged that way by large companies to simplify the process for the average end user.

Wyatt8740

Posted 2013-12-06T21:38:46.950

Reputation: 943