Conda-based options
Option 1: Resolve any environment file
The conda package
command includes functionality for resolving the package of origin given a file. This is provided by the -w,--which
command.
Documentation (abridged)
$ conda package -h
usage: conda package [-h] [-n ENVIRONMENT | -p PATH] [-w PATH [PATH ...]] [-r] [-u] [--pkg-name PKG_NAME] [--pkg-version PKG_VERSION] [--pkg-build PKG_BUILD]
Low-level conda package utility. (EXPERIMENTAL)
Options:
optional arguments:
-h, --help Show this help message and exit.
-w PATH [PATH ...], --which PATH [PATH ...]
Given some PATH print which conda package the file came from.
...
There's a tput
in my base's bin/
so running on that, I get:
$ conda package --which tput
tput conda-forge/osx-arm64::ncurses-6.3-h07bb92c_1
That is, ncurses
looks like the culprit.
Option 2: Executables Only
There is a neat Conda Incubator package called conda-suggest
that I've found useful. This uses a database of executable files from Conda Forge packages to identify what Conda Forge packages provide them.
This again works out nicely with OP's example:
## install it to base
$ conda install -n base conda-forge::conda-suggest
$ conda suggest message 'tput'
Command 'tput' not found in the environment, but can be installed with # # any of:
$ conda install -c conda-forge ncurses
So, ncurses
is the only package on Conda Forge that installs this executable.
Unfortunately, the database is not regularly updated and only covers Conda Forge. On the upside, one doesn't need the package installed, and it accepts regex.
conda list |grep ncurses
and see whether it is installed.strings
on it?