# How to install Ghostscript

## Table of contents

> - Overview of how to install Ghostscript
> - Installing Ghostscript on Unix
>   - Ghostscript as a shared object
>   - Additional notes on Linux
> - Installing Ghostscript on MS Windows
> - Installing Ghostscript on OpenVMS
> - Installing Ghostscript on DOS
> - Installing Ghostscript on OS/2 2.x

For other information, see the Ghostscript overview and "How to build Ghostscript from source code".

## Overview of how to install Ghostscript

You must have three things to run Ghostscript:

1. The Ghostscript executable file; on some operating systems, more than one file is required. These are entirely platform-specific. See below for details.
2. Initialization files that Ghostscript reads in when it starts up; these are the same on all platforms.
   - `gs_`*`.ps` unless Ghostscript was compiled using the "compiled initialization files" option. See the documentation of PostScript files distributed with Ghostscript.
   - `pdf_`*`.ps` if Ghostscript was compiled with the ability to interpret Adobe Portable Document Format (PDF) files, that is, `pdf.dev` was included in `FEATURE_DEVS` when Ghostscript was built.
   - `Fontmap` and `Fontmap.GS` (or the appropriate `Fontmap.`xxx for your platform), unless you plan always to invoke Ghostscript with the `-dNOFONTMAP` switch.
3. Fonts, for rendering text. These are platform-independent, but if you already have fonts of the right kind on your platform, you may be able to use those. See below for details. Also see the documentation on fonts.

The usage documentation describes the search algorithms used to find initialization files and font files. The per-platform descriptions that follow tell you where to install these files.

## Installing Ghostscript on Unix

Ghostscript uses the common configure, build and install method common to many modern software packages. In general the following with suffice to build ghostscript:

> `./configure
> make`

and then it may be installed in the default location with:

> `make install`

This last command may need to be performed with super user privileges.

You can set the installation directory by adding `--prefix=path` to the configure invocation in the first step. The default prefix is `/usr/local`, which is to say the `gs` executable is installed as `/usr/local/bin/gs`.

A list of similar configuration options is available via `./configure --help`

For more detailed information on building Ghostscript see how to build Ghostscript on Unix in the documentation on building Ghostscript, especially regarding information on using the older hand edited makefile approach. Whatever configuration method you use, execute "`make install`" to install the executable and all the required and ancillary files after the build is complete.

### Fonts

The makefile installs all the files except fonts under the directory defined in the makefile as `prefix`. Fonts need to be installed separately. The fonts should be installed in `{prefix}/share/ghostscript/fonts`. (That is, `/usr/local/share/ghostscript/fonts/` if you used the default configuration above.)

If you have Adobe Acrobat installed, you can use the Acrobat fonts in place of the ones distributed with with Ghostscript by adding the Acrobat fonts directory to `GS_FONTPATH` and removing these fonts from `Fontmap.GS`:

> Courier, Courier-Bold, Courier-BoldOblique, Courier-Oblique, Helvetica, Helvetica-Bold, Helvetica-BoldOblique, Helvetica-Oblique, Symbol, Times-Bold, Times-BoldItalic, Times-Italic, Times-Roman, ZapfDingbats

Similarly, you can have ghostscript use other fonts on your system by adding entries to the fontmap or adding the directories to the GS_FONTMAP environment variable. See the usage documentation for more information. For example, many linux distributions place fonts under `/usr/share/fonts`.

### Ghostscript as a shared object

If you've built Ghostscript as a shared object, instead of '`make install`', you must use '`make soinstall`'. See how to build Ghostscript as a shared object for more details.

### Additional notes on Linux

For Linux, you may be able to install or upgrade Ghostscript from precompiled RPM files using:

> `rpm -U ghostscript-N.NN-1.i386.rpm
> rpm -U ghostscript-fonts-N.NN-1.noarch.rpm`

However, please note that we do not create RPMs for Ghostscript, and we take no responsibility for RPMs created by others.

## Installing Ghostscript on MS Windows

We usually distribute Ghostscript releases for Windows as self-extracting archive files, since this is the most convenient form for users. These files can also be unpacked as if they were plain zip files.

The self-extracting archive is normally named `gs###w32.exe`, where ### is the release number (e.g., 650 for Ghostscript 6.50, 700 for Ghostscript 7.00).

### Windows 95/98 and NT 4

To install a self-extracting Ghostscript archive on Windows 95/98 or Windows NT4/2000, you need just this self-extracting archive file. Run this file to install Ghostscript.

Alternatively, if you have the zip file, unzip it to a temporary directory then run the included `setupgs.exe`. After the setup program has finished, remove the temporary files.

After installing Ghostscript, it is strongly recommended that you install the GSview previewer, which provides an easier to use graphical interface for Ghostscript. Information on GSview is available from:

> http://www.cs.wisc.edu/~ghost/gsview/

### General Windows configuration

The archive includes files in these subdirectories:

> `gs#.##\bin
> gs#.##\lib
> gs#.##\examples
> gs#.##\doc
> fonts`

The actual executable files, in the `gs#.##\bin` subdirectory, are:

> `GSWIN32.EXE` |  | 32-bit Ghostscript using windows
> `GSWIN32C.EXE` |  | 32-bit Ghostscript using only the command line
> `GSDLL32.DLL` |  | 32-bit dynamic link library containing most of Ghostscript's functionality

See "Installing Ghostscript on DOS" below for information about using Adobe Type Manager, Adobe Type Basics, or Adobe Acrobat fonts. If your system uses TrueType fonts, you can get them converted to a Ghostscript-compatible format at the time you select your "printer" by doing the following:

> 1. Open control panel and double-click on the "Printers" icon.
> 2. Select your PostScript printer.
> 3. Choose Setup.
> 4. Choose Options.
> 5. Choose Advanced.
> 6. At the top of the dialog box you will see TrueType Fonts Send to Printer As: Choose (drop-down menu) Adobe Type 1.
> 7. Uncheck Use Printer Fonts for All TrueType Fonts and Use Substitution Table.
> 8. OK.
> 9. OK etc.

That's it! Your TrueType fonts will automatically be downloaded in your PostScript file for Ghostscript to use.

For printer devices, the default output is:

> The default printer |  | Win95 or WinNT
> Prompt for a printer port |  | Win32s (Windows 3.1)

This can be modified as follows.

> `-sOutputFile="LPT1:"`
>   Output to the named port.
> `-sOutputFile="%printer%printer name"` (Windows 95, 98, NT or 2000)
>   Output to the named printer. If your printer is named "HP DeskJet 500" then you would use `-sOutputFile="%printer%HP DeskJet 500"`.
> `-sOutputFile="\\spool\printer name"` (Windows 3.1/Win32s)
>   Output to the named printer. Note that this is NOT a UNC name.

If Ghostscript fails to find an environment variable, it looks for a registry value of the same name under the key

> `HKEY_CURRENT_USER\Software\AFPL Ghostscript\#.##`

or if that fails, under the key

> `HKEY_LOCAL_MACHINE\SOFTWARE\AFPL Ghostscript\#.##`

where #.## is the Ghostscript version number. This does not work under Win32s (that is, Windows 3.1, which doesn't support named registry values).

Ghostscript will attempt to load the Ghostscript dynamic link library `GSDLL32.DLL` in the following order:

- In the same directory as the Ghostscript executable.
- If the environment variable `GS_DLL` is defined, Ghostscript tries to load the Ghostscript dynamic link library (DLL) with the name given.
- Using the standard Windows library search method: the directory from which the application loaded, the current directory, the Windows system directory, the Windows directory and the directories listed in the PATH environment variable.

The Ghostscript setup program will create registry values for the environment variables `GS_LIB` and `GS_DLL`.

### Uninstalling Ghostscript on Windows

To uninstall Ghostscript, use the Control Panel, Add/Remove Programs and remove "Ghostscript #.##" and "Ghostscript Fonts". (The entries may be called "Aladdin Ghostscript" or "AFPL Ghostscript", rather than just "Ghostscript", depending on what version of Ghostscript was installed.)

## Installing Ghostscript on OpenVMS

You need the file `GS.EXE` to run Ghostscript on OpenVMS, and installing Ghostscript on an OpenVMS system requires building it first: please read how to build Ghostscript on VMS in the documentation on building Ghostscript.

The following installation steps assume that the Ghostscript directory is `DISK1:[DIR.GHOSTSCRIPT]`. Yours will almost certainly be in a different location so adjust the following commands accordingly.

- Download the fonts and unpack them into `DISK1:[DIR.GHOSTSCRIPT.LIB]`.
- Enable access to the program and support files for all users with:

  >     $ set file/prot=w:re DISK1:[DIR]GHOSTSCRIPT.dir
  >     $ set file/prot=w:re DISK1:[DIR.GHOSTSCRIPT...]*.*

- Optionally, add the Ghostscript help instructions to your system wide help file:

  >     $ lib/help sys$help:HELPLIB.HLB DISK1:[DIR.GHOSTSCRIPT.DOC]GS-VMS.HLP

- Lastly, add the following lines to the appropriate system wide or user specific login script.

  >     $ define gs_exe DISK1:[DIR.GHOSTSCRIPT.BIN]
  >     $ define gs_lib DISK1:[DIR.GHOSTSCRIPT.EXE]
  >     $ gs :== $gs_exe:gs.exe

If you have DECWindows/Motif installed, you may wish to replace the `FONTMAP.GS` file with `FONTMAP.VMS`. Read the comment at the beginning of the latter file for more information.

## Installing Ghostscript on DOS

You need the files `GS386.EXE` and `DOS4GW.EXE` to run Ghostscript. You should install all the files except the fonts in `C:\GS`, and the fonts in `C:\GS\FONTS`.

If you have Adobe Type Manager (ATM) fonts installed on your system, and you wish to use them with Ghostscript, you may wish to replace the `FONTMAP` file with `FONTMAP.ATM`, and to add to the environment variable `GS_LIB` the name of the directory where the fonts are located (see Use.htm for more information about `GS_LIB`). Before you do this, please read carefully the license that accompanies the ATM fonts; we take no responsibility for any possible violations of such licenses. Similarly, if you have Adobe Type Basics, you may wish to replace `FONTMAP` with `FONTMAP.ATB`. Finally, if you have neither ATM nor ATB but you have Adobe Acrobat installed, you can use the Acrobat fonts in place of the ones provided with Ghostscript by adding the Acrobat fonts directory to `GS_FONTPATH` and removing these fonts from `FONTMAP`:

> Courier, Courier-Bold, Courier-BoldOblique, Courier-Oblique, Helvetica, Helvetica-Bold, Helvetica-BoldOblique, Helvetica-Oblique, Symbol, Times-Bold, Times-BoldItalic, Times-Italic, Times-Roman, ZapfDingbats

## Installing Ghostscript on OS/2 2.x

The Ghostscript OS/2 implementation is designed for OS/2 2.1 or later. A few people have used it successfully under OS/2 2.0, but it has had very little testing. You need these files to run Ghostscript on OS/2:

> `GSOS2.EXE` |  | A text application that will run windowed or full screen
> `GSDLL2.DLL` |  | A dynamic link library that must be in the same directory as `GSOS2.EXE` or on the `LIBPATH`.
> `GSPMDRV.EXE` |  | An "external driver" used by the "`os2pm`" device, which is normally the default device and which displays output in a Presentation Manager window; `GSPMDRV.EXE` must be located in the same directory as `GSOS2.EXE` or on the `PATH`

`GSOS2.EXE`, `GSDLL2.DLL` and `GSPMDRV.EXE` are compiled using EMX/GCC 0.9d. You must have the EMX DLLs on your `LIBPATH`; they are available in a package `emxrt.zip` from many places on the Internet, so you can find the package by using a search engine or an ftp lookup service such as the one at

> http://ftpsearch.lycos.com/

The system menu of the Ghostscript Image window includes a "Copy" command to copy the currently displayed bitmap to the Clipboard.

OS/2 comes with some Adobe Type Manager fonts. If you wish to use these with Ghostscript, you should replace the `FONTMAP` file with `FONTMAP.OS2`, and add to the environment variable `GS_LIB` (see Use.htm for more information about `GS_LIB`) the name of the directory where the fonts are located, usually `C:\PSFONTS`. Before you do this, please read carefully the license that accompanies the ATM fonts; we take no responsibility for any possible violations of such licenses.

Since `GSOS2.EXE` is not a PM application, it cannot determine the depth of the PM display. You must provide this information using the `-dBitsPerPixel` option. Valid values are 1, 4, 8 (the default), and 24.

> Use |  | For
> `-dBitsPerPixel=1` |  | VGA monochrome
> `-dBitsPerPixel=4` |  | VGA standard
> `-dBitsPerPixel=8` |  | SVGA 256 colors

A command file `gspm.cmd` containing the following line may be useful:

> `@c:\gs\gsos2.exe -Ic:/gs;c:/gs/fonts;c:/psfonts -sDEVICE=os2pm -dBitsPerPixel=8 -sPAPERSIZE=a4 %1 %2 %3 %4 %5 %6 %7 %8`

While drawing, the `os2pm` driver updates the display every 5 seconds. On slow computers this is undesirable, and a different interval can be specified in milliseconds with the `-dUpdateInterval` option, with a default of `-dUpdateInterval=5000`; to disable update, use `-dUpdateInterval=0`.

Standard VGA is very slow because it uses double buffering to avoid bugs and because of 1-plane to 4-plane conversion; it's better to use a 256-color display driver. Many display drivers have bugs which cause 1 bit-per-pixel bitmaps to be displayed incorrectly.

`GSOS2.EXE` and `GSPMDRV.EXE` will stay in memory for the number of minutes specified in the environment variable `GS_LOAD`.

If you run `GS386` in the OS/2 2.0 or 2.1 DOS box, you must select the "ENABLED" setting for the DPMI_DOS_API option of the DOS box. `GS386` will not run with the "AUTO" setting.

For printer devices, output goes to the default queue. To print to a specified queue, use `-sOutputFile=\\spool\NullLPT1`, where `NullLPT1` is the queue's physical name.

Copyright © 2000-2006 artofcode LLC. All rights reserved.

This software is provided AS-IS with no warranty, either express or implied. This software is distributed under license and may not be copied, modified or distributed except as expressly authorized under the terms of that license. Refer to licensing information at http://www.artifex.com/ or contact Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information.

Ghostscript version 8.54, 17 May 2006