Nullsoft Scriptable Install System


Nullsoft Scriptable Install System is a script-driven installer authoring tool for Microsoft Windows backed by Nullsoft, the creators of Winamp. NSIS is released under a combination of free software licenses, primarily the zlib license. It has become a widely used alternative to commercial proprietary products like InstallShield, with users including Amazon.com, Dropbox, Google, Ubisoft, FL Studio, BitTorrent, and McAfee.

History

NSIS was created to distribute Winamp. It is based on a previous Nullsoft product, PiMP, and is also known as SuperPiMP. After version 2.0a0, the project was moved to SourceForge where developers outside Nullsoft started working on it on a regular basis. NSIS 2.0 was released approximately two years later.
NSIS version 1 is in many ways similar to the classic Windows Installer, but it supports more compression formats. NSIS version 2 features a new streamlined graphical user interface and supports LZMA compression, multiple languages, and an easy-to-use plugin system.
In January 2006 NSIS was SourceForge's project of the month.

Script examples

Hello world!


!include "MUI.nsh"
!insertmacro MUI_LANGUAGE "English"
Name "Hello world!" # Name of the installer.
OutFile "HelloWorld.exe" # Name of the installer's file.
Function.onInit # Function that will be executed on installer's start up.
MessageBox MB_OK|MB_ICONINFORMATION "Hello world!" # Show a message that says "Hello world!".
Quit # Close the installer because this is a simple "Hello world!" installer.
FunctionEnd
Section # Useless section because this is a simple "Hello world!" installer.
SectionEnd

Simple installer


!include "MUI.nsh"
!define MUI_ABORTWARNING # This will warn the user if they exit from the installer.
!insertmacro MUI_PAGE_WELCOME # Welcome to the installer page.
!insertmacro MUI_PAGE_DIRECTORY # In which folder install page.
!insertmacro MUI_PAGE_INSTFILES # Installing page.
!insertmacro MUI_PAGE_FINISH # Finished installation page.
!insertmacro MUI_LANGUAGE "English"
Name "MyApp" # Name of the installer.
OutFile "MyAppInstaller.exe" # Name of the installer's file.
InstallDir "$PROGRAMFILES\MyApp" # Default installing folder.
ShowInstDetails show # This will always show the installation details.
Section "MyApp" # In this section add your files or your folders.
# Add your files with "File ", example: "File "$DESKTOP\MyApp.exe"" ; or add your folders always with "File \*", always add your folders with an asterisk, example: "File /r $DESKTOP\MyApp\*".
SectionEnd

Concepts

Script

The NSIS compiler program makensis compiles scripts like the following example into executable installation programs. Each line in the script contains a single command.

  1. Example script
Name "Example1"
OutFile "jubaowu.exe"
InstallDir "$PROGRAMFILES\Example1"
Page Directory
Page InstFiles
Section
SetOutPath $INSTDIR
File..\makensis.exe
SectionEnd

Modern user interface

Version 2.0 introduced a new optional streamlined graphical user interface called Modern UI. The MUI has a wizard-like interface. It supports a welcome page, finish page, language selection dialog, description area for components, and greater customization options than the old user interface.

  1. Modern UI example script
!include MUI.nsh
Name "Example 2"
OutFile "Example2.exe"
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "license.rtf"
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_LANGUAGE "English"
!insertmacro MUI_LANGUAGE "German"
!insertmacro MUI_LANGUAGE "French"
Section "Extract makensis"
SetOutPath $INSTDIR
File..\makensis.exe
SectionEnd

Since NSIS version 2.30 there is new version of this UI accessible: Modern UI 2 which is an enhancement to Modern UI. Unlike the old MUI this version is based on nsDialogs instead of old-fashioned InstallOptions.ini files.
From version 2.34 this MUI2 is ready for mass consumption and it is included in all NSIS packages. Also all examples had been switched to it.
Modern UI 2 documentation.

Graphical interfaces

NSIS projects can be configured by simply editing text files. However, several third parties provide editing software:
Several projects that extend or replace the Modern UI have started in the past few years. Interfaces such as the ExperienceUI and UltraModernUI completely change the style of the installer by skinning it to look like the InstallShield interface. Other interfaces like installSpiderUI aim for a more minimalistic approach on the visual side of things while maintaining the same level of functionality as the ASD.

Plugins

NSIS can be extended with plugins that can communicate with the installer. Plugins can be written in any unmanaged programming language capable of building a dynamic-link library, and they can be used to perform installation tasks or extend the installer interface. A plugin can be called with a single line of NSIS code.
Several plugins come with the NSIS package that permit the installer to display a splash screen, display a custom page, display an image on the background, download files from a website, perform mathematical operations, patch files and more.
Other plugins are available online, including ZipDLL, and a Python plugin.

Features

NSIS supports the following features:
The generated installer is a Portable Executable, with the installation files archived within the installer, a 34 KB overhead for the NSIS installer, and the installation script compiled into executable code. As the installation script is compiled, the script cannot be obtained from the delivered executable without reverse-engineering the binary.
The archive may be unpacked using 7-Zip, the Total Commander plugin InstallExplorer, or the FAR Manager plugin InstallExplorer.
The archive contains several folders:
The generated installer includes command line arguments in order to give users more control:
Versions of NSIS before 3.0 did not support Unicode, but only a means to convert some files to different encodings via a plugin. However, a variant of NSIS that has full Unicode support is available. Notable projects using this variant are:
With the release of version 3.0 of NSIS, Unicode support can be implemented using the compiler directive "Unicode true". This gives full Unicode support with no further code changes, but the installer will not run under Windows 95/98/Me. As of 2016 before the 3.0 release NSIS was available in the PortableApps format for Unicode 2.46.5 Rev 3 and ANSI 2.51.