installation.html 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>xmake</title>
  6. <link rel="icon" href="/assets/img/favicon.ico">
  7. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
  8. <meta name="description" content="Description">
  9. <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
  10. <link href="/assets/npm/github-markdown/github-markdown.min.css" rel="stylesheet">
  11. <style>
  12. .markdown-body {
  13. box-sizing: border-box;
  14. min-width: 200px;
  15. max-width: 980px;
  16. margin: 0 auto;
  17. padding: 45px;
  18. }
  19. @media (max-width: 767px) {
  20. .markdown-body {
  21. padding: 15px;
  22. }
  23. }
  24. </style>
  25. </head>
  26. <body>
  27. <article class="markdown-body">
  28. <h4>This is a mirror page, please see the original page: </h4><a href="https://xmake.io/#/guide/installation">https://xmake.io/#/guide/installation</a>
  29. <div id="wwads-panel" class="wwads-cn wwads-vertical wwads-sticky" data-id="239" style="max-width:180px;bottom:20px;right:20px;width:200px;height:260px;background:#fff;position:fixed"></div>
  30. </br>
  31. <script type="text/javascript" charset="UTF-8" src="https://cdn.wwads.cn/js/makemoney.js" async></script>
  32. <script async type="text/javascript" src="//cdn.carbonads.com/carbon.js?serve=CE7I52QU&placement=xmakeio" id="_carbonads_js"></script>
  33. <style>
  34. #carbonads {
  35. font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu,
  36. Cantarell, "Helvetica Neue", Helvetica, Arial, sans-serif;
  37. }
  38. #carbonads {
  39. display: flex;
  40. max-width: 330px;
  41. background-color: hsl(0, 0%, 98%);
  42. box-shadow: 0 1px 4px 1px hsla(0, 0%, 0%, .1);
  43. }
  44. #carbonads a {
  45. color: inherit;
  46. text-decoration: none;
  47. }
  48. #carbonads a:hover {
  49. color: inherit;
  50. }
  51. #carbonads span {
  52. position: relative;
  53. display: block;
  54. overflow: hidden;
  55. }
  56. #carbonads .carbon-wrap {
  57. display: flex;
  58. }
  59. .carbon-img {
  60. display: block;
  61. margin: 0;
  62. line-height: 1;
  63. }
  64. .carbon-img img {
  65. display: block;
  66. }
  67. .carbon-text {
  68. font-size: 13px;
  69. padding: 10px;
  70. line-height: 1.5;
  71. text-align: left;
  72. }
  73. .carbon-poweredby {
  74. display: block;
  75. padding: 8px 10px;
  76. background: repeating-linear-gradient(-45deg, transparent, transparent 5px, hsla(0, 0%, 0%, .025) 5px, hsla(0, 0%, 0%, .025) 10px) hsla(203, 11%, 95%, .4);
  77. text-align: center;
  78. text-transform: uppercase;
  79. letter-spacing: .5px;
  80. font-weight: 600;
  81. font-size: 9px;
  82. line-height: 1;
  83. }
  84. </style>
  85. <h2 id="master">Master</h2>
  86. <p>!> Note! Xmake is not recommended to install under root!</p>
  87. <h4 id="viacurl">via curl</h4>
  88. <pre><code class="lang-bash">curl -fsSL https://xmake.io/shget.text | bash
  89. </code></pre>
  90. <p>If you want to install a specific version and branch, you can append the version number and branch parameters later</p>
  91. <pre><code class="lang-bash">curl -fsSL https://xmake.io/shget.text | bash -s dev
  92. curl -fsSL https://xmake.io/shget.text | bash -s v2.7.7
  93. </code></pre>
  94. <h4 id="viawget">via wget</h4>
  95. <pre><code class="lang-bash">wget https://xmake.io/shget.text -O - | bash
  96. </code></pre>
  97. <h4 id="viapowershell">via powershell</h4>
  98. <pre><code class="lang-powershell">Invoke-Expression (Invoke-Webrequest &#39;https://xmake.io/psget.text&#39; -UseBasicParsing).Content
  99. </code></pre>
  100. <p>If you want to install a specific version and branch, you can append the version number and branch parameters later</p>
  101. <pre><code class="lang-powershell">Invoke-Expression (Invoke-Webrequest &#39;https://xmake.io/psget.text&#39; -UseBasicParsing).Content dev
  102. Invoke-Expression (Invoke-Webrequest &#39;https://xmake.io/psget.text&#39; -UseBasicParsing).Content v2.7.7
  103. </code></pre>
  104. <p>!> If the ps script execution prompt fails, you can try to execute in administrator mode.</p>
  105. <h2 id="windows">Windows</h2>
  106. <h3 id="viainstaller">via installer</h3>
  107. <ol>
  108. <li>Download the Xmake windows installer from <a href="https://github.com/xmake-io/xmake/releases">Releases</a></li>
  109. <li>Run xmake-[version].[win32|win64].exe</li>
  110. </ol>
  111. <p>!> Releases/xmake-[version].[win32|win64].zip has not installer, we need unzip it and add PATH environment variables by ourself.</p>
  112. <p>In addition, the installation package with <code>xmake-tinyc-xxx.exe</code>, which integrates the tinyc compiler environment, and comes with libc and winapi header files. By installing this package, you can compile c programs normally without msvc.<br>This is very useful for users who want to write some c tests or algorithm codes temporarily, but don&#39;t want to install msvc, but the installation package will be slightly larger than 2-3M.</p>
  113. <h3 id="viascoop">via scoop</h3>
  114. <pre><code class="lang-bash">scoop install xmake
  115. </code></pre>
  116. <h3 id="viawinget">via winget</h3>
  117. <pre><code class="lang-bash">winget install xmake
  118. </code></pre>
  119. <h2 id="msysmingw">Msys/Mingw</h2>
  120. <h3 id="mingw64">mingw64</h3>
  121. <pre><code class="lang-bash">pacman -Sy mingw-w64-x86_64-xmake
  122. </code></pre>
  123. <h3 id="mingw32">mingw32</h3>
  124. <pre><code class="lang-bash">pacman -Sy mingw-w64-i686-xmake
  125. </code></pre>
  126. <h2 id="macos">MacOS</h2>
  127. <pre><code class="lang-bash">brew install xmake
  128. </code></pre>
  129. <h2 id="archlinux">Arch Linux</h2>
  130. <pre><code class="lang-bash">sudo pacman -Sy xmake
  131. </code></pre>
  132. <h2 id="alpinelinux">Alpine Linux</h2>
  133. <pre><code class="lang-bash">sudo apk add xmake
  134. </code></pre>
  135. <h2 id="ubuntu">Ubuntu</h2>
  136. <h3 id="viaapt">via apt</h3>
  137. <pre><code class="lang-bash">sudo add-apt-repository ppa:xmake-io/xmake
  138. sudo apt update
  139. sudo apt install xmake
  140. </code></pre>
  141. <p>Also, Xmake has recently been added to the official Debian repositories: <a href="https://packages.debian.org/sid/xmake">https://packages.debian.org/sid/xmake</a></p>
  142. <h2 id="fedorarhelopensusecentos">Fedora/RHEL/OpenSUSE/CentOS</h2>
  143. <p>For Fedora 39 and above, you can install directly from the official repositories using the following command:</p>
  144. <pre><code class="lang-bash">sudo dnf install xmake
  145. </code></pre>
  146. <p>We can also install from the Copr repository:</p>
  147. <pre><code class="lang-bash">sudo dnf copr enable waruqi/xmake
  148. sudo dnf install xmake
  149. </code></pre>
  150. <h2 id="gentoo">Gentoo</h2>
  151. <ol>
  152. <li>Refer to <a href="https://wiki.gentoo.org/wiki/Project:GURU/Information_for_End_Users">here</a> to add GURU to your system repository</li>
  153. <li>Install dev-util/xmake</li>
  154. </ol>
  155. <pre><code class="lang-bash">sudo emerge -a --autounmask dev-util/xmake
  156. </code></pre>
  157. <h2 id="otherlinux">Other Linux</h2>
  158. <p>Download xmake <code>xmake-x.x.x.gz.run</code> install package from <a href="https://github.com/xmake-io/xmake/releases">Releases</a> </p>
  159. <pre><code class="lang-bash">sudo chmod 777 ./xmake-x.x.x.gz.run
  160. ./xmake-x.x.x.gz.run
  161. </code></pre>
  162. <h2 id="freebsd">FreeBSD</h2>
  163. <p>Due to package name conflicts, only xmake-io can be used as the package name.</p>
  164. <pre><code class="lang-bash">pkg install xmake-io
  165. </code></pre>
  166. <h2 id="termuxandroid">Termux (Android)</h2>
  167. <pre><code class="lang-bash">pkg install xmake
  168. </code></pre>
  169. <h2 id="bundlepackage">Bundle package</h2>
  170. <p>If you don&#39;t want to install, we also provide another Bundle packaging format, which does not require user installation, a single executable file, can be run and used after downloading, and is easy to distribute.</p>
  171. <p>It will build all Lua scripts into the Xmake executable file, without the need for additional installation and configuration of any environment variables.</p>
  172. <p>We can get them from <a href="https://github.com/xmake-io/xmake/releases">Releases</a>, and there are currently some Bundle packages as follows.</p>
  173. <pre><code>xmake-bundle-v2.9.8.arm64.exe
  174. xmake-bundle-v2.9.8.cosmocc
  175. xmake-bundle-v2.9.8.linux.x86_64
  176. xmake-bundle-v2.9.8.macos.arm64
  177. xmake-bundle-v2.9.8.macos.x86_64
  178. xmake-bundle-v2.9.8.win32.exe
  179. xmake-bundle-v2.9.8.win64.exe
  180. </code></pre><p>Among them, the package with the <code>.cosmocc</code> suffix provides the ability to run across platforms, but the support for Windows is still relatively weak, and it is not recommended to use it on Windows.</p>
  181. <p>The others are single executable files for specific platforms, and users can download and use them as needed according to their own systems.</p>
  182. <h2 id="sourcecompilationandinstallation">Source compilation and installation</h2>
  183. <h3 id="installation">Installation</h3>
  184. <p>!> Note! Xmake is not recommended to install under root!</p>
  185. <pre><code class="lang-bash">git clone --recursive https://github.com/xmake-io/xmake.git
  186. cd ./xmake
  187. # On macOS, you may need to run: export SDKROOT=$(xcrun --sdk macosx --show-sdk-path)
  188. ./configure
  189. make
  190. ./scripts/get.sh __local__ __install_only__
  191. source ~/.xmake/profile
  192. </code></pre>
  193. <p>If you think the source of github is too slow, you can pull it through the mirror source of gitee or gitlab: </p>
  194. <pre><code class="lang-bash">git clone --recursive https://gitee.com/tboox/xmake.git
  195. git clone --recursive https://gitlab.com/tboox/xmake.git
  196. </code></pre>
  197. <p>!> Since the current Xmake source maintains dependencies via git submodule, it is necessary to add the <code>--recursive</code> parameter to pull all submodules at the same time. Please do not download the tar.gz source directly, because github does not automatically package submodules. Code.</p>
  198. <p>If you forget to add <code>--recursive</code> when git clone, you can also execute <code>git submodule update --init</code> to pull all submodules, for example:</p>
  199. <pre><code class="lang-bash">git clone https://github.com/xmake-io/xmake.git
  200. cd ./xmake
  201. git submodule update --init
  202. ./configure
  203. make
  204. ./scripts/get.sh __local__ __install_only__
  205. </code></pre>
  206. <p>!> <code>./get.sh __local__</code> is installed to <code>~/.local/xmake</code>, and then loaded by <code>source ~/.xmake/profile</code>, so after the installation, the current terminal fails to execute Xmake, If the prompt is not found, manually execute <code>source ~/.xmake/profile</code>, and the next time you open the terminal, you don&#39;t need it.</p>
  207. <h3 id="sourcecompilationinwindowsplatform">Source compilation in Windows platform</h3>
  208. <pre><code class="lang-bash">git clone --recursive https://github.com/xmake-io/xmake.git
  209. cd ./xmake/core
  210. xmake
  211. </code></pre>
  212. <h3 id="onlyupdatetheluascript">Only update the lua script</h3>
  213. <p>This developer needs to debug the Xmake source locally:</p>
  214. <pre><code class="lang-bash">./scripts/get.sh __local__ __install_only__
  215. </code></pre>
  216. <h3 id="rootinstallation">Root installation</h3>
  217. <p>Xmake is not recommended for root installation, because this is very insecure. If the user has to download the root, if the prompt Xmake fails to run, please pass the <code>--root</code> parameter as prompted or set <code>XMAKE_ROOT=y</code>. The environment variable is forcibly enabled, provided that the user needs to pay attention to the risk of incorrect operating system file files under root.</p>
  218. <h3 id="dependencyissues">Dependency issues</h3>
  219. <ol>
  220. <li>If you encounter problems with readline, please install readline-devel or libreadline-dev dependencies. This is optional. It is only needed when the <code>xmake lua</code> command executes REPL.</li>
  221. <li>If you want to speed up compilation, you can install ccache, Xmake will automatically detect and use, which is also optional.</li>
  222. </ol>
  223. <h2 id="otherinstallationmethods">Other installation methods</h2>
  224. <p>!> This is also the source code compilation and installation, but the installation path will be written directly to <code>/usr/</code>, which requires root privileges, so unless special circumstances, this installation method is not recommended, it is recommended to use the <code>./get. Sh __local__</code> way to install, the installation path of the two installation methods is different, do not mix.</p>
  225. <p>Compile and install via make:</p>
  226. <pre><code class="lang-bash">./configure
  227. make
  228. sudo make install
  229. </code></pre>
  230. <p>Install to other specified directories:</p>
  231. <pre><code class="lang-bash">sudo make install PREFIX=/usr/local
  232. </code></pre>
  233. <h2 id="updateupgrade">Update Upgrade</h2>
  234. <p>Starting with v2.2.3, the <code>xmake update</code> command has been added to quickly update and upgrade itself. The default is to upgrade to the latest version. Of course, you can also specify to upgrade or roll back to a version:</p>
  235. <pre><code class="lang-bash">xmake update 2.7.1
  236. </code></pre>
  237. <p>We can also specify an update to the master/dev branch version:</p>
  238. <pre><code class="lang-bash">xmake update master
  239. xmake update dev
  240. </code></pre>
  241. <p>Update from the specified git source</p>
  242. <pre><code class="lang-bash">xmake update github:xmake-io/xmake#master
  243. xmake update gitee:tboox/xmake#dev # gitee mirror
  244. </code></pre>
  245. <p>If just update the xmake lua script changes, you can add <code>-s/--scriptonly</code> to quickly update the lua script.</p>
  246. <pre><code class="lang-bash">xmake update -s dev
  247. </code></pre>
  248. <p>Finally, if we want to uninstall Xmake, we&#39;re sorry to see you go! Still, it is supported: <code>xmake update --uninstall</code>.</p>
  249. </article>
  250. </body>
  251. </html>