/xmake-skills:xmake-env-varsfrom xmake-skills
Configures xmake via environment variables — paths, profiling, color mode, root access, and user-wide defaults. Use when debugging xmake source or customizing build environments.
Ships in xmake-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Xmake reads a handful of XMAKE_* environment variables to relocate config, enable profiling, load user-wide defaults, and more. They take precedence over the matching xmake g global setting when both are present.
xmake show -l envs
Shows every recognized variable, its description, and the currently resolved value on your system.
| Variable | Purpose | Default |
|---|---|---|
XMAKE_PROGRAM_DIR | Where xmake's Lua scripts live | xmake install dir |
XMAKE_PROGRAM_FILE | Which xmake binary to use | resolved from PATH |
XMAKE_GLOBALDIR | Root for xmake g global config (creates .xmake/ inside) | ~ |
XMAKE_CONFIGDIR | Where per-project .xmake/ cache goes | project dir |
XMAKE_TMPDIR | Temp scratch | /tmp/.xmake / %TEMP%\.xmake |
XMAKE_RAMDIR | Optional ramdisk for temp files — fastest | unset |
XMAKE_PKG_INSTALLDIR | Package install root | $XMAKE_GLOBALDIR/.xmake/packages |
XMAKE_PKG_CACHEDIR | Package cache dir | $XMAKE_GLOBALDIR/.xmake/cache |
XMAKE_LOGFILE | Log everything xmake does to this file | unset |
Typical uses:
# Use a local source checkout of xmake (developing xmake itself — see xmake-dev skill)
export XMAKE_PROGRAM_DIR=/path/to/xmake/xmake
export XMAKE_PROGRAM_FILE=/path/to/xmake/core/build/xmake
# Keep project .xmake out of the repo root
export XMAKE_CONFIGDIR=/tmp/myproject-xmake
# Put packages on a fast disk
export XMAKE_PKG_INSTALLDIR=/mnt/fast/xmake-packages
export XMAKE_PKG_CACHEDIR=/mnt/fast/xmake-cache
# Ram-disk temp for crazy-fast configures
export XMAKE_RAMDIR=/dev/shm/xmake
| Variable | Values | Purpose |
|---|---|---|
XMAKE_COLORTERM | nocolor / color8 / color256 / truecolor | Force color mode |
XMAKE_PROFILE | stuck / trace / perf:call / perf:tag / perf:process | Profiling / stuck debug — see xmake-troubleshooting |
XMAKE_ROOT | y | Allow running as root (off by default — unsafe) |
XMAKE_LOGFILE | path | Mirror xmake output to a log file |
XMAKE_THEME | theme name | Equivalent to xmake g --theme=... |
XMAKE_RCFILESXmake loads a user-specified "rc" file before any xmake.lua is parsed. Use it for global toolchains, default repos, company-wide policies — anything you want every project on the machine to pick up.
# Unix: colon-separated multiple files
export XMAKE_RCFILES=~/.xmake/xmakerc.lua:/etc/xmake/xmakerc.lua
# Windows: semicolon-separated
set XMAKE_RCFILES=C:\xmake\xmakerc.lua;D:\proj\xmakerc.lua
Example ~/.xmake/xmakerc.lua:
-- Always enable debug+release modes
add_rules("mode.debug", "mode.release")
-- Company-wide package repo
add_repositories("mycompany https://github.com/mycompany/xmake-repo.git")
-- Pin a preferred toolchain
toolchain("mygcc")
set_kind("standalone")
set_toolset("cc", "gcc-11")
set_toolset("cxx", "g++-11")
toolchain_end()
Precedence: rc files load before the project xmake.lua, so the project can still override anything they set.
For settings that have both an env var and a xmake g equivalent:
xmake g global configxmake f configSo XMAKE_COLORTERM=nocolor xmake always disables color, regardless of xmake g --theme.
From inside a script-domain hook:
on_load(function (target)
local configdir = os.getenv("XMAKE_CONFIGDIR")
if configdir then
print("using config dir %s", configdir)
end
end)
os.getenv is one of the few env-reading APIs allowed in the description domain as read-only — fine for conditional config flags.
# CI: disable color, log everything
XMAKE_COLORTERM=nocolor XMAKE_LOGFILE=build.log xmake
# Debug a stuck build
XMAKE_PROFILE=stuck xmake f -c
# Profile configure
XMAKE_PROFILE=perf:process xmake f -c
# Dev xmake from a checkout
source scripts/srcenv.profile # sets XMAKE_PROGRAM_DIR + _FILE
# Cache-aware CI
XMAKE_PKG_CACHEDIR=$HOME/ci-cache/xmake-pkg xmake
XMAKE_PROGRAM_DIR after a dev test. Leaves xmake pointing at a stale checkout. unset XMAKE_PROGRAM_DIR to restore.XMAKE_RCFILES breaks projects. A rc file that force-adds rules/toolchains can clash with a project that configures its own. Scope rc files carefully; prefer description-only.XMAKE_ROOT=y. Works, but running as root is dangerous — prefer a regular user.xmake g. If xmake g --color256 seems ignored, check whether XMAKE_COLORTERM is exported.XMAKE_LOGFILE appends; rotate it yourself if enabled permanently.XMAKE_PROGRAM_* → xmake-devXMAKE_PROFILE) → xmake-troubleshootingxmake-theme, xmake-color-outputWhat SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub xmake-io/xmake-skills --plugin xmake-skills58 skills in this plugin
/xmake-addon-developmentUse when writing an Xmake addon — the `addon.lua` manifest, the payload layout (plugins/rules/toolchains/modules/includes/templates), `@self` references, shipping package definitions with an addon, `add_globalmodules`, testing it locally, and publishing it to xmake-repo as an `addon` kind package./xmake-addonsUse when installing or using an Xmake addon — `xmake addon --install/--list/--remove/--upgrade/--search`, declaring `add_addons(...)` in a project, and referencing addon payloads with `@addon/<name>/<rule>`, `@addon.<name>.<module>` or `@self`. For writing and publishing one, see xmake-addon-development./xmake-async-jobsUse when running parallel / async work inside xmake scripts — `async.runjobs` for parallel job execution, `async.jobgraph` (DAG) for dependency-ordered jobs, `async.jobpool` (tree structure), `core.base.scheduler` coroutine scheduling, semaphores, and `on_build_files(..., {jobgraph = true})` in rules. For running external compile jobs faster, see `xmake-build-optimization`./xmake-basicsUse when the user is starting a new Xmake project, installing Xmake, or needs the minimal xmake.lua structure. Covers installation, `xmake create`, the project layout, and the smallest valid xmake.lua./xmake-build-cacheUse when configuring or debugging xmake's local build cache (built-in, replaces ccache) or the remote compile cache service (shared across machines via `xmake service --ccache`). Covers enabling/disabling, fallbacks to external ccache, remote cache server/client setup, and cache cleaning./xmake-build-optimizationUse when a project builds slowly and you want to make it faster — parallel jobs, unity build, precompiled headers, build cache, LTO, link-time improvements, binary package cache, and profiling with `XMAKE_PROFILE=perf:*`. Covers idiomatic xmake speedups and the order to try them.Other plugins' skills for the same job