Next: Creating Packages, Previous: Using Packages, Up: Packages [Contents][Index]

### 37.3 Administrating Packages

It is possible to make both per-user (local) and system-wide (global) installations of a package. If the user performing the installation is `root` (or Administrator with elevated privileges on Windows), the packages by default install in a system-wide directory that defaults to `OCTAVE_HOME/share/octave/packages/`. If the user is not `root` (or Octave is running without elevated privileges), packages are installed locally. The default installation directory for local packages is `user_data_dir/octave/OCTAVE_API_VERSION/packages`. Packages will be installed in a subdirectory of the installation directory that will be named after the package. It is possible to change the installation directory by using the `pkg prefix` command:

    pkg prefix new_installation_directory

The current installation directory can be retrieved by typing

    current_installation_directory = pkg ("prefix")

The package manager stores some information about the installed packages in configuration files. For per-user (local) packages, this information is stored in the file `user_config_dir/octave/OCTAVE_API_VERSION/octave_packages` by default. For system-wide (global) installations, it is stored in `OCTAVE_HOME/share/octave/octave_packages`. The path to the per-user file can be changed with the `pkg local_list` command:

    pkg local_list /path/to/new_file

For system-wide installations, this can be changed in the same way using the `pkg global_list` command. If these commands are called without a new path, the current path will be returned. To retain these settings between sessions, they can be set in one of the startup files, see Startup Files.