conan profile

Manage profiles

conan profile detect

$ conan profile detect -h
Migration: Successfully updated settings.yml
Migration: Successfully updated cppstd_compat.py
usage: conan profile detect [-h] [-v [V]] [-cc CORE_CONF] [--name NAME] [-f]

Generate a profile using auto-detected values.

options:
  -h, --help            show this help message and exit
  -v [V]                Level of detail of the output. Valid options from less
                        verbose to more verbose: -vquiet, -verror, -vwarning,
                        -vnotice, -vstatus, -v or -vverbose, -vv or -vdebug,
                        -vvv or -vtrace
  -cc CORE_CONF, --core-conf CORE_CONF
                        Global configuration for Conan
  --name NAME           Profile name, 'default' if not specified
  -f, --force           Overwrite if exists

Warning

The output of conan profile detect is not stable. It can change at any time in future Conan releases to adapt to latest tools, latest versions, or other changes in the environment. See the Conan stability section for more information.

You can create a new auto-detected profile for your configuration using:

auto-detected profile
$ conan profile detect
Found apple-clang 14.0
apple-clang>=13, using the major as version
Detected profile:
[settings]
arch=x86_64
build_type=Release
compiler=apple-clang
compiler.cppstd=gnu17
compiler.libcxx=libc++
compiler.version=14
os=Macos

WARN: This profile is a guess of your environment, please check it.
WARN: Defaulted to cppstd='gnu17' for apple-clang.
WARN: The output of this command is not guaranteed to be stable and can change in future Conan versions.
WARN: Use your own profile files for stability.
Saving detected profile to /Users/barbarians/.conan2/profiles/default

Be aware that if the profile already exists you have to use --force to overwrite it. Otherwise it will fail

force overwriting already existing default profile
$ conan profile detect
ERROR: Profile '/Users/carlosz/.conan2/profiles/default' already exists
$ conan profile detect --force
Found apple-clang 14.0
...
Saving detected profile to /Users/carlosz/.conan2/profiles/default

Note

Best practices It is not recommended to use conan profile detect in production. To guarantee reproducibility, it is recommended to define your own profiles, store them in a git repo or in a zip in a server, and distribute it to your team and CI machines with conan config install, together with other configuration like custom settings, custom remotes definition, etc.

conan profile list

$ conan profile list -h
WARN: Downgrading cache from Conan 2.4.1 to 2.1.0
WARN: Applying downgrade migration 2.4_1-migrate.py
Migration: Successfully updated cppstd_compat.py
usage: conan profile list [-h] [-f FORMAT] [-v [V]] [-cc CORE_CONF]

List all profiles in the cache.

options:
  -h, --help            show this help message and exit
  -f FORMAT, --format FORMAT
                        Select the output format: json
  -v [V]                Level of detail of the output. Valid options from less
                        verbose to more verbose: -vquiet, -verror, -vwarning,
                        -vnotice, -vstatus, -v or -vverbose, -vv or -vdebug,
                        -vvv or -vtrace
  -cc CORE_CONF, --core-conf CORE_CONF
                        Global configuration for Conan
force overwriting already existing default profile
$ conan profile list
Profiles found in the cache:
default
ios_base
ios_simulator
clang_15

conan profile path

$ conan
WARN: Downgrading cache from Conan 2.4.1 to 2.1.0
WARN: Applying downgrade migration 2.4_1-migrate.py
Migration: Successfully updated cppstd_compat.py

Consumer commands
cache      Perform file operations in the local cache (of recipes and/or packages).
config     Manage the Conan configuration in the Conan home.
graph      Compute a dependency graph, without installing or building the binaries.
inspect    Inspect a conanfile.py to return its public fields.
install    Install the requirements specified in a recipe (conanfile.py or conanfile.txt).
list       List existing recipes, revisions, or packages in the cache (by default) or the
             remotes.
lock       Create or manage lockfiles.
profile    Manage profiles.
remote     Manage the remote list and the users authenticated on them.
remove     Remove recipes or packages from local cache or a remote.
search     Search for package recipes in all the remotes (by default), or a remote.
version    Give information about the Conan client version.

Creator commands
build      Install dependencies and call the build() method.
create     Create a package.
download   Download (without installing) a single conan package from a remote server.
editable   Allow working with a package that resides in user folder.
export     Export a recipe to the Conan package cache.
export-pkg Create a package directly from pre-compiled binaries.
new        Create a new example recipe and source files from a template.
source     Call the source() method.
test       Test a package from a test_package folder.
upload     Upload packages to a remote.

Type "conan <command> -h" for help

Use to get the profile location in your [CONAN_HOME] folder:

$ conan profile path default
/Users/barbarians/.conan2/profiles/default

conan profile show

$ conan profile show -h
Error executing: conan profile show -h
WARN: Downgrading cache from Conan 2.4.1 to 2.1.0
WARN: Applying downgrade migration 2.4_1-migrate.py
Migration: Successfully updated cppstd_compat.py
ERROR: [Errno 2] No such file or directory: '/root/.conan2/migrations/2.4_1-migrate.py'

Use conan profile show to compute the resulting build and host profiles from the command line arguments. For example, combining different options and settings with the default profile or with any other profile using the pr:b or pr:h arguments:

$ conan profile show -s:h build_type=Debug -o:h shared=False
Host profile:
[settings]
arch=x86_64
build_type=Debug
compiler=apple-clang
compiler.cppstd=gnu17
compiler.libcxx=libc++
compiler.version=14
os=Macos
[options]
shared=False
[conf]


Build profile:
[settings]
arch=x86_64
build_type=Release
compiler=apple-clang
compiler.cppstd=gnu17
compiler.libcxx=libc++
compiler.version=14
os=Macos
[conf]

It’s also useful to show the result of the evaluation of jinja2 templates in the profiles. For example, a profile like this:

myprofile
[settings]
os = {{ {"Darwin": "Macos"}.get(platform.system(), platform.system()) }}

Check the evaluated profile:

$ conan profile show -pr:h=myprofile
Host profile:
[settings]
os=Macos
[conf]
...

The command can also output a json with the results:

$ conan profile show --format=json

{
"host": {
    "settings": {
        "arch": "armv8",
        "build_type": "Release",
        "compiler": "apple-clang",
        "compiler.cppstd": "gnu17",
        "compiler.libcxx": "libc++",
        "compiler.version": "15",
        "os": "Macos"
    },
    "package_settings": {},
    "options": {},
    "tool_requires": {},
    "conf": {},
    "build_env": ""
},
"build": {
    "settings": {
        "arch": "armv8",
        "build_type": "Release",
        "compiler": "apple-clang",
        "compiler.cppstd": "gnu17",
        "compiler.libcxx": "libc++",
        "compiler.version": "15",
        "os": "Macos"
    },
    "package_settings": {},
    "options": {},
    "tool_requires": {},
    "conf": {},
    "build_env": ""
}
}

See also