# Manage your Packages when You Install a New Version of TERR

When a new version of TERR is released, you might want to install it to take advantage of the changes. You can run older and newer versions of TERR on the same computer, or you can uninstall the older version(s). In either case, you probably want to make sure any custom-created packages or packages downloaded from a repository are kept available to the TERR version(s) you are running.

Tip: Uninstalling TERR does not remove the packages you installed. However, we recommend that you check for updates to any packages you have downloaded from package repositories after you install a new version of TERR. You can check for updated versions by calling `update.packages()`. See the help topic for `update.packages()` in the TERR Language Reference for more information.

The TERR installation includes the directory TERR_HOME/site-library, which is used by default. If you want to use another directory, you can define the environment variable TERR_LIBS_SITE and set it to the directory of your choice.

Initially, the site-library directory is empty. If you have permission to write to the TERR_HOME directory, any packages you create or download are installed in TERR_HOME/site-library.

Installing packages to the site-library directory provides the following advantages.

- It provides you with the means to protect and manage the packages you installed and want to keep, separate from the new installation.
- It separates the packages shipped with TERR so they can be updated with new releases, and so you do not accidentally change or remove them.
  Warning: You should avoid changing any entries in the TERR_HOME/library directory. Doing so can cause TERR to behave in unexpected ways.

The directory TERR_HOME/site-library is added to the head of the search path, which is returned by `.libPaths()`. For example, on a Windows computer where you have permission to write to the TERR_HOME directory, this function call would appear as follows.

    > .libPaths()
    [1] "C:/Program Files/spotfire/terr61/site-library"
    [2] "C:/Program Files/spotfire/terr61/library"

After installing the new version of TERR, you can just copy the packages from the older TERR_HOME/site-library directory to the new TERR_HOME/site-library directory.

Note: If you are downloading packages to a computer where you do not have permission to write to the directory TERR_HOME/site-library, then packages are stored in the user directory. For example, on Windows, this directory is [My Documents]/TERR/x86_64-pc-windows-library/<version>, and, calling `.libPaths()` would appear as follows.

    > .libPaths()
    [1] "C:/users/jdoe/Documents/TERR/x86_64-pc-windows-library/terr6.1"
    [2] "C:/Program Files/spotfire/terr61/site-library"
    [3] "C:/Program Files/spotfire/terr61/library"

In this case, you can ignore the site-library directory (which remains empty) and manage your packages by copying them from the older <version> to the new <version> in the user directory location.