conan profile

Manage profiles

conan profile detect

$ conan profile detect -h
WARN: Downgrading cache from Conan 2.6.0 to 2.4.1
usage: conan profile detect [-h] [-v [V]] [-cc CORE_CONF] [--name NAME] [-f]
                            [-e]

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
                        Define core configuration, overwriting global.conf
                        values. E.g.: -cc core:non_interactive=True
  --name NAME           Profile name, 'default' if not specified
  -f, --force           Overwrite if exists
  -e, --exist-ok        If the profile already exist, do not detect a new one

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
Migration: Successfully updated settings.yml
Migration: Successfully updated cppstd_compat.py
Migration: Successfully updated profile.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
                        Define core configuration, overwriting global.conf
                        values. E.g.: -cc core:non_interactive=True
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.6.0 to 2.4.1

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.
pkglist    Several operations over package lists
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
WARN: Downgrading cache from Conan 2.7.1 to 2.4.1
usage: conan profile show [-h] [-f FORMAT] [-v [V]] [-cc CORE_CONF]
                          [-pr PROFILE] [-pr:b PROFILE_BUILD]
                          [-pr:h PROFILE_HOST] [-pr:a PROFILE_ALL]
                          [-o OPTIONS] [-o:b OPTIONS_BUILD]
                          [-o:h OPTIONS_HOST] [-o:a OPTIONS_ALL] [-s SETTINGS]
                          [-s:b SETTINGS_BUILD] [-s:h SETTINGS_HOST]
                          [-s:a SETTINGS_ALL] [-c CONF] [-c:b CONF_BUILD]
                          [-c:h CONF_HOST] [-c:a CONF_ALL]

Show aggregated profiles from the passed arguments.

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
                        Define core configuration, overwriting global.conf
                        values. E.g.: -cc core:non_interactive=True
  -pr PROFILE, --profile PROFILE
                        Apply the specified profile. By default, or if
                        specifying -pr:h (--profile:host), it applies to the
                        host context. Use -pr:b (--profile:build) to specify
                        the build context, or -pr:a (--profile:all) to specify
                        both contexts at once
  -pr:b PROFILE_BUILD, --profile:build PROFILE_BUILD
  -pr:h PROFILE_HOST, --profile:host PROFILE_HOST
  -pr:a PROFILE_ALL, --profile:all PROFILE_ALL
  -o OPTIONS, --options OPTIONS
                        Apply the specified options. By default, or if
                        specifying -o:h (--options:host), it applies to the
                        host context. Use -o:b (--options:build) to specify
                        the build context, or -o:a (--options:all) to specify
                        both contexts at once. Example: -o pkg:with_qt=true
  -o:b OPTIONS_BUILD, --options:build OPTIONS_BUILD
  -o:h OPTIONS_HOST, --options:host OPTIONS_HOST
  -o:a OPTIONS_ALL, --options:all OPTIONS_ALL
  -s SETTINGS, --settings SETTINGS
                        Apply the specified settings. By default, or if
                        specifying -s:h (--settings:host), it applies to the
                        host context. Use -s:b (--settings:build) to specify
                        the build context, or -s:a (--settings:all) to specify
                        both contexts at once. Example: -s compiler=gcc
  -s:b SETTINGS_BUILD, --settings:build SETTINGS_BUILD
  -s:h SETTINGS_HOST, --settings:host SETTINGS_HOST
  -s:a SETTINGS_ALL, --settings:all SETTINGS_ALL
  -c CONF, --conf CONF  Apply the specified conf. By default, or if specifying
                        -c:h (--conf:host), it applies to the host context.
                        Use -c:b (--conf:build) to specify the build context,
                        or -c:a (--conf:all) to specify both contexts at once.
                        Example: -c tools.cmake.cmaketoolchain:generator=Xcode
  -c:b CONF_BUILD, --conf:build CONF_BUILD
  -c:h CONF_HOST, --conf:host CONF_HOST
  -c:a CONF_ALL, --conf:all CONF_ALL

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