package , a built-in Tcl procedure, manages packages in a Tcl interpreter.


package forget ?package package ...?
package ifneeded package version ?script?
package names
package present ?-exact? package ?version?
package provide package ?version?
package require ?-exact? package ?version?
package unknown ?command?
package vcompare version1 version2
package versions package
package vsatisfies version1 version2


official reference

See Also

Magic names
User Guide
Developer Guide
pkg_mkIndex pitfalls
Using Tk as a loadable package
Where does the package command find the packages it seeks?
package management
Tcl syntax
Fulfilling the Promise of package unknown, by DGP
A presentation given at the Eighth Annual Tcl/Tk Conference
package , by dgp
A drop-in replacement for package that adds a maxVersion feature and the additional subcommands index, mkdepend, and prerequisites. Also renames vcompare to compare and vsatisfies to satisfies.


DGP, PYK: The man page for pkg_mkIndex covers the basics in the HOW IT WORKS section. For now pkgIndex.tcl is the primary way to manage packages in an interpreter, but stay tuned for better ideas. We don't want to be chained to pkgIndex.tcl files forever.

See also pkg_mkIndex pitfalls.


dgp, Tcl Chatroom, 2014-10-07, made the following comments regarding improvements to package or a similar facility for Tcl:

Ought to install per-namespace. Ought to fallback from, instead of die on errors. Ought to enforce namespace containment. Might need to have some kind of manifest facility. Ought to define an installation procedure. If it must make that customizable, then customizing finding and installing must be done together. Should continue to support multiple versions installed in parallel. Should support simultaneous install of different versions into different namespaces.
Gathering packages' ifneeded scripts
A proposal to implement a cache to improve performance.