{"id":6573,"date":"2025-06-27T15:50:00","date_gmt":"2025-06-27T13:50:00","guid":{"rendered":"https:\/\/www.hanshafner.de\/blog\/?p=6573"},"modified":"2025-07-25T08:55:30","modified_gmt":"2025-07-25T06:55:30","slug":"install-xcode-command-line-tools-macos","status":"publish","type":"post","link":"https:\/\/www.hanshafner.de\/blog\/2025\/06\/27\/install-xcode-command-line-tools-macos\/","title":{"rendered":"Install Xcode Command-Line Tools (macOS)"},"content":{"rendered":"\n<p>Many small macOS scripts and developer utilities rely on Apple&#8217;s&nbsp;<em>Command-Line Tools for Xcode<\/em>&nbsp;package. Among other things, it ships:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>git<\/code>,\u00a0<code>svn<\/code>, and other version-control binaries<\/li>\n\n\n\n<li><code>clang<\/code>\u00a0&amp; friends for compiling C\/C++\/Obj-C<\/li>\n\n\n\n<li><code>make<\/code>,\u00a0<code>ld<\/code>,\u00a0<code>strip<\/code>,\u00a0<code>ar<\/code>,\u00a0<code>nm<\/code>, \u2026<\/li>\n\n\n\n<li><code>SetFile<\/code>,\u00a0<code>PlistBuddy<\/code>, and dozens of helper tools used in shell scripts<\/li>\n<\/ul>\n\n\n\n<p>If you ever tried to run&nbsp;<code>git<\/code>&nbsp;on a fresh Mac and saw a dialog asking to &#8220;Install Command Line Developer Tools&#8221;, this is what macOS was talking about. Below are three quick ways to get them.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>Time required: ? 2 \u2013 3 minutes on a fast connection (700 MB download). No Apple-ID sign-in needed unless you prefer the full Xcode route.<\/p>\n<\/blockquote>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>1. One-liner in Terminal (fastest)<\/strong><\/h2>\n\n\n\n<ol start=\"1\" class=\"wp-block-list\">\n<li>Open\u00a0<strong>Terminal.app<\/strong>\u00a0(? Space ?\u00a0<em>Terminal<\/em>).<\/li>\n\n\n\n<li>Run:<code>xcode-select --install<\/code><\/li>\n\n\n\n<li>A small dialog appears \u2013 click\u00a0<strong>Install<\/strong>\u00a0and accept the license.<\/li>\n<\/ol>\n\n\n\n<p>That&#8217;s it. After the installer finishes you can verify with:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>xcode-select -p   # ? \/Library\/Developer\/CommandLineTools\nclang --version    # should print Apple clang \u2026<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>2. Via the full Xcode app (App Store)<\/strong><\/h2>\n\n\n\n<p>Installing the full 20 GB Xcode bundle also drops the command-line tools on your system. Choose this path only if you plan to use the Xcode IDE.<\/p>\n\n\n\n<ol start=\"1\" class=\"wp-block-list\">\n<li>Open the\u00a0<strong>App Store<\/strong>\u00a0and search for\u00a0<em>Xcode<\/em>.<\/li>\n\n\n\n<li>Click\u00a0<strong>Get<\/strong>\u00a0\/\u00a0<strong>Install<\/strong>\u00a0(Apple-ID required).<\/li>\n\n\n\n<li>Once Xcode finishes downloading, open it once so it can install its components.<\/li>\n\n\n\n<li>Verify:<code>xcode-select -p # ? \/Applications\/Xcode.app\/Contents\/Developer<\/code><\/li>\n<\/ol>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>3. Manual&nbsp;<\/strong><code>.pkg<\/code>&nbsp;download (offline machines)<\/h2>\n\n\n\n<p>Apple hosts standalone installer packages on the Developer website:<\/p>\n\n\n\n<ol start=\"1\" class=\"wp-block-list\">\n<li>Sign in at\u00a0<a href=\"https:\/\/developer.apple.com\/download\/all\/?q=command\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/developer.apple.com\/download\/all\/?q=command<\/a><a href=\"https:\/\/developer.apple.com\/download\/all\/?q=command%20line%20tools\" target=\"_blank\" rel=\"noreferrer noopener\"> line tools<\/a>\u00a0(free account).<\/li>\n\n\n\n<li>Download the DMG that matches your macOS version, e.g.\u00a0<em>Command Line Tools for Xcode 15.3<\/em>.<\/li>\n\n\n\n<li>Mount the DMG and double-click the\u00a0<strong>.pkg<\/strong>\u00a0inside.<\/li>\n<\/ol>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Accepting the license non-interactively<\/strong><\/h2>\n\n\n\n<p>Scripting a fleet of Macs? After installation run:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo xcodebuild -license accept<\/code><\/pre>\n\n\n\n<p>This pre-accepts the license so build systems won&#8217;t hang waiting for T&amp;C confirmation.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Uninstalling (rarely needed)<\/strong><\/h2>\n\n\n\n<p>To remove the standalone tools:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo rm -rf \/Library\/Developer\/CommandLineTools<\/code><\/pre>\n\n\n\n<p>Then reinstall with&nbsp;<code>xcode-select --install<\/code>&nbsp;whenever you need them again.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>?? Do&nbsp;<strong>not<\/strong>&nbsp;delete if they live inside&nbsp;<code>Xcode.app<\/code>&nbsp;\u2013 use Launchpad or Finder-&gt;Applications to remove Xcode instead.<\/p>\n<\/blockquote>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Troubleshooting<\/strong><\/h2>\n\n\n\n<p>\u2022&nbsp;<em>&#8220;Command line tools are already installed, use Software Update to install updates.&#8221;<\/em>&nbsp;\u2013 They&#8217;re present; run&nbsp;<code>softwareupdate -l<\/code>&nbsp;to check for newer versions.<br>\u2022&nbsp;<code>xcode-select: error: command line tools are already installed, use Software Update to install<\/code>&nbsp;\u2013 same as above.<br>\u2022&nbsp;<code>git: command not found<\/code>&nbsp;even after installing \u2013 Open a&nbsp;<strong>new<\/strong>&nbsp;Terminal window or run&nbsp;<code>hash -r<\/code>&nbsp;to refresh your shell&#8217;s path cache.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Wrap-up<\/strong><\/h2>\n\n\n\n<p>You now have Apple&#8217;s developer toolkit on your Mac. Most of the scripts in this repo (including the&nbsp;<em>Hide Logic Extension<\/em>&nbsp;helper) will &#8220;just work&#8221; from here on.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Many small macOS scripts and developer utilities rely on Apple&#8217;s&nbsp;Command-Line Tools for Xcode&nbsp;package. Among other things, it ships: If you ever tried to run&nbsp;git&nbsp;on a fresh Mac and saw a dialog asking to &#8220;Install Command Line Developer Tools&#8221;, this is what macOS was talking about. Below are three quick ways to get them. Time required: [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,233],"tags":[234],"class_list":["post-6573","post","type-post","status-publish","format-standard","hentry","category-blog-2","category-tools","tag-macos"],"_links":{"self":[{"href":"https:\/\/www.hanshafner.de\/blog\/wp-json\/wp\/v2\/posts\/6573","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hanshafner.de\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hanshafner.de\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hanshafner.de\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hanshafner.de\/blog\/wp-json\/wp\/v2\/comments?post=6573"}],"version-history":[{"count":1,"href":"https:\/\/www.hanshafner.de\/blog\/wp-json\/wp\/v2\/posts\/6573\/revisions"}],"predecessor-version":[{"id":6574,"href":"https:\/\/www.hanshafner.de\/blog\/wp-json\/wp\/v2\/posts\/6573\/revisions\/6574"}],"wp:attachment":[{"href":"https:\/\/www.hanshafner.de\/blog\/wp-json\/wp\/v2\/media?parent=6573"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hanshafner.de\/blog\/wp-json\/wp\/v2\/categories?post=6573"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hanshafner.de\/blog\/wp-json\/wp\/v2\/tags?post=6573"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}