Master版本 
!> 切记,xmake不建议在root下安装和使用,所以尽量不要在root下拉取源码编译安装!
使用curl 
curl -fsSL https://xmake.io/shget.text | bash如果要安装指定版本和分支,后面可以追加版本号和分支参数
curl -fsSL https://xmake.io/shget.text | bash -s dev
curl -fsSL https://xmake.io/shget.text | bash -s v2.7.7使用wget 
wget https://xmake.io/shget.text -O - | bash使用powershell 
Invoke-Expression (Invoke-Webrequest 'https://xmake.io/psget.text' -UseBasicParsing).Content如果要安装指定版本和分支,后面可以追加版本号和分支参数
Invoke-Expression (Invoke-Webrequest 'https://xmake.io/psget.text' -UseBasicParsing).Content dev
Invoke-Expression (Invoke-Webrequest 'https://xmake.io/psget.text' -UseBasicParsing).Content v2.7.7!> 如果ps脚本执行提示失败,可以尝试在管理员模式下执行
Windows 
使用安装包 
- 从 Releases 上下载windows安装包
 - 运行安装程序 xmake-[version].[win32|win64].exe
 
!> releases下面xmake-[version].[win32|win64].zip的包是不带安装程序的,可直接解压使用,绿色无依赖,不过需要自己添加PATH环境变量。
另外,Releases下面带有 xmake-tinyc 开头的exe安装包,内部集成了 tinyc 编译器环境,自带 libc 和 winapi 头文件,安装这个包,可以实现在没有 msvc 环境下,也能正常编译 c 程序。 这对于临时想写一些 c 测试或者算法代码,又不想安装 msvc 的用户非常有用,不过安装包会稍微大2-3M,不过也还好。
使用scoop 
scoop install xmake使用winget 
winget install xmakeMsys/Mingw 
现在msys/pacman官方仓库已经收录xmake软件包,可直接通过pacman安装。
mingw64 
pacman -Sy mingw-w64-x86_64-xmakemingw32 
pacman -Sy mingw-w64-i686-xmakeMacOS 
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install xmake或者:
- 从 Releases 上下载pkg安装包
 - 双击运行
 
或者安装master版本:
# 使用homebrew安装master版本
brew install xmake --HEAD
# 或者直接调用shell下载安装
bash <(curl -fsSL https://xmake.io/shget.text)Arch Linux 
sudo pacman -Sy xmakeAlpine Linux 
sudo apk add xmakeUbuntu 
使用apt安装 
sudo add-apt-repository ppa:xmake-io/xmake
sudo apt update
sudo apt install xmake另外,近期 Xmake 已经被收入到 Debian 官方仓库:https://packages.debian.org/sid/xmake
Fedora/RHEL/OpenSUSE/CentOS 
Fedora 39 以上版本,可以直接使用下面的命令从官方仓库安装:
sudo dnf install xmake我们也可以从 Copr 仓库安装:
sudo dnf copr enable waruqi/xmake
sudo dnf install xmakeGentoo 
- 参考这里将GURU添加到你的系统仓库
 - 安装dev-util/xmake
 
sudo emerge -a --autounmask dev-util/xmake其他Linux 
先从 Releases 上下载xmake-x.x.x.gz.run自安装包
然后运行这个自安装包。
sudo chmod 777 ./xmake-x.x.x.gz.run
./xmake-x.x.x.gz.runFreeBSD 
见下文源码编译安装,并使用gmake来代替make。
Termux (Android) 
pkg install xmake源码编译安装 
安装 
!> 切记,xmake不建议在root下安装和使用,所以尽量不要在root下拉取源码编译安装!
git clone --recursive https://github.com/xmake-io/xmake.git
cd ./xmake
./configure
make
./scripts/get.sh __local__ __install_only__
source ~/.xmake/profile如果觉得github的源太慢,可以通过gitee的镜像源拉取:clone --recursive https://gitee.com/tboox/xmake.git 也可以如下修改~/.gitconfig,永久解决github clone慢的问题
[url "ssh://git@github.com/"]
  insteadOf = https://github.com/!> 由于目前xmake源码通过git submodule维护依赖,所以clone的时候需要加上--recursive参数同时拉取所有submodules代码,请不要直接下载tar.gz源码,因为github不会自动打包submodules里面的代码。
如果git clone的时候忘记加--recursive,那么也可以执行git submodule update --init来拉取所有submodules,例如:
git clone https://github.com/xmake-io/xmake.git
cd ./xmake
git submodule update --init
./configure
make
./scripts/get.sh __local__ __install_only__!> ./get.sh __local__是安装到~/.local/xmake下,然后通过source ~/.xmake/profile方式来加载的,所以安装完,当前终端如果执行xmake失败,提示找不到,就手动执行下 source ~/.xmake/profile,而下次打开终端就不需要了。
Windows平台源码安装 
git clone --recursive https://github.com/xmake-io/xmake.git
cd ./xmake/core
xmake仅仅更新安装lua脚本 
这个开发者本地调试xmake源码才需要:
./scripts/get.sh __local__ __install_only__root下安装 
xmake不推荐root下安装使用,因为这很不安全,如果用户非要root下装,装完后,如果提示xmake运行不了,请根据提示传递--root参数,或者设置XMAKE_ROOT=y环境变量强行启用下,前提是:用户需要随时注意root下误操作系统文件文件的风险。
依赖问题 
- 如果遇到readline相关问题,请装下readline-devel或者libreadline-dev依赖,这个是可选的,仅仅
xmake lua命令执行REPL时候才需要。 - 如果想要提速编译,可以装下ccache,xmake会自动检测并使用,这也是可选的。
 
其他安装方式 
!> 这种也是源码编译安装,但是安装路径会直接写入/usr/下,需要root权限,因此除非特殊情况,不推荐这种安装方式,建议采用上文提供的./get.sh __local__方式来安装,这两种安装方式的安装路径是不同的,不要混用。
通过make进行编译安装:
./configure
make
sudo make install安装到其他指定目录:
sudo make install PREFIX=/usr/local更新升级 
从v2.2.3版本开始,新增了xmake update命令,来快速进行自我更新和升级,默认是升级到最新版本,当然也可以指定升级或者回退到某个版本:
xmake update 2.7.1我们也可以指定更新到master/dev分支版本:
xmake update master
xmake update dev从指定git源更新
xmake update github:xmake-io/xmake#master
xmake update gitee:tboox/xmake#dev # gitee镜像如果xmake/core没动过,仅仅更新xmake的lua脚本改动,可以加-s/--scriptonly快速更新lua脚本
xmake update -s dev最后,我们如果要卸载xmake,也是支持的:xmake update --uninstall