'''package names''' Returns a list of the names of all packages in the interpreter for which a version has been provided (via '''[package provide]''') or for which a '''[package ifneeded]''' script is available. The order of elements in the list is arbitrary. ---- '''package names''' will only deliver all available packages if it has searched all package indices before. To force this, do a dummy '''[package require]''' before: catch {package require nonexistentName} package names '''[DGP]''' - To be more precise, [[package names]] returns a list of all the package names that are already known to the [[package]] command. That is not the same as all the names that could become known by operation of the [[package unknown]] callback. The default [[package unknown]] callback is [[tclPkgUnknown]] and it is that default callback that exhibits the behavior described above -- after one run, all installed package names are known. The [[package unknown]] interface does not require that behavior, and other callbacks may not (IMHO, should not) implement it. [Lars H]: Feeling slightly Cantorian, I'd propose the following for a foolproof (never loading a package, even if it's got a bizarre name) method of listing all package names: proc all_package_names {} { if {[package unknown] eq ""} then { return [package names] } set res "" while {$res ne [set res [package names]]} { uplevel #0 [package unknown] [list $res+1 ""] } return $res } The idea is that "[[package names]]+1" cannot be the name of a package known to the package database, so telling [package unknown] to search for it will force some additional data to be entered, even for a very lazy package unknown handler. ---- See also: * [package] * [package provide] * [package require] * [package unknown] * [package versions] ---- [Tcl syntax help] - [Category Command] - [Category Introspection]