-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathxcode-command-line-tools.html
More file actions
284 lines (281 loc) · 21.4 KB
/
xcode-command-line-tools.html
File metadata and controls
284 lines (281 loc) · 21.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0; url=https://mac.install.guide/commandlinetools/index.html">
<link rel="canonical" href="https://mac.install.guide/commandlinetools/index.html" />
<meta charset="utf-8" />
<title>Install Xcode Command Line Tools</title>
<meta name="viewport" content="width=device-width">
<meta name="description" content="How to install Xcode Command Line Tools. Complete guide to installation.">
<meta name="keywords" content="tutorial install Apple Xcode Command Line Tools">
<link href="https://plus.google.com/117374718581973393536" rel="publisher">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/foundation/5.2.2/css/normalize.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/foundation/5.2.2/css/foundation.min.css">
<link rel="stylesheet" href="http://railsapps.github.io/css/xcode-with-offer.css" />
<link rel="stylesheet" href="http://railsapps.github.io/css/syntax.css" />
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.2/modernizr.min.js"></script>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="http://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
<script type="text/javascript">
window.analytics=window.analytics||[],window.analytics.methods=["identify","group","track","page","pageview","alias","ready","on","once","off","trackLink","trackForm","trackClick","trackSubmit"],window.analytics.factory=function(t){return function(){var a=Array.prototype.slice.call(arguments);return a.unshift(t),window.analytics.push(a),window.analytics}};for(var i=0;i<window.analytics.methods.length;i++){var key=window.analytics.methods[i];window.analytics[key]=window.analytics.factory(key)}window.analytics.load=function(t){if(!document.getElementById("analytics-js")){var a=document.createElement("script");a.type="text/javascript",a.id="analytics-js",a.async=!0,a.src=("https:"===document.location.protocol?"https://":"http://")+"cdn.segment.io/analytics.js/v1/"+t+"/analytics.min.js";var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(a,n)}},window.analytics.SNIPPET_VERSION="2.0.9",
window.analytics.load("l1stqfqqbf");
window.analytics.page();
window.analytics.ready(function () {
ga('require', 'linker');
ga('linker:autoLink', ['railscomposer.com','learn-rails.com','blog.railsapps.org','tutorials.railsapps.org']);
});
</script>
<!-- Social button scripts-->
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="http://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
</head>
<body>
<header class="masthead">
<div class="fixed">
<nav class="top-bar" data-topbar>
<ul class="title-area">
<li class="name">
<a href="http://railsapps.github.io/" class="brand">RailsApps Project</a>
</li>
<li class="toggle-topbar menu-icon"><a href="#"><span>Menu</span></a></li>
</ul>
<section class="top-bar-section">
<ul class="right">
<li><a href="https://tutorials.railsapps.org/" class="google">Tutorials</a></li>
<li><a href="http://twitter.com/rails_apps" class="twitter">Twitter</a></li>
<li><a href="http://blog.railsapps.org/" class="twitter">Blog</a></li>
<li><a href="https://github.com/RailsApps" class="github">GitHub Repository</a></li>
</ul>
</section>
</nav>
</div>
</header>
<section class="intro">
<div class="row">
<div class="medium-6 columns margin-top">
<p class="lead">WATCH THE VIDEO
<br /><em>XCode Command Line Tools</em>
</p>
<p class="button-top"><a class="button alert radius" href="https://fullstackvideos.com/videos/7">FREE VIDEO</a></p>
</div>
<div class="medium-6 columns">
<a href="https://fullstackvideos.com/videos/7">
<img alt="xcode command line tools" src="/images/xcode-command-line-tools.png">
</a>
<div class="social-sharing margin-top">
<div style="display:inline-block; vertical-align:text-bottom;">
<a class="twitter-share-button" data-count="horizontal" data-text="the best book for Rails beginners 'Learn Ruby on Rails'" data-url="http://learn-rails.com/learn-ruby-on-rails.html" data-via="rails_apps" data-related="rails_apps:Author of the book" href="http://twitter.com/share"></a>
<div class="g-plusone" data-annotation="bubble" data-href="http://learn-rails.com/learn-ruby-on-rails.html" data-size="medium" data-width="90"></div>
<div class="fb-like" data-href="http://learn-rails.com/learn-ruby-on-rails.html" data-width="90" data-layout="button_count" data-show-faces="false" data-send="false"></div>
</div>
</div>
</div>
</div>
</section>
<div class="row">
<div class="large-12 columns">
<div class="content wikistyle gollum textile">
<br />
<br />
<h1>Xcode Command Line Tools</h1>
<h4>by Daniel Kehoe</h4>
<p><em>Last updated 7 December 2016</em></p>
<p>How to install Apple Xcode Command Line Tools for macOS Sierra. Complete guide to installation.</p>
<p>Xcode is a large suite of software development tools and libraries from Apple. The Xcode Command Line Tools are part of XCode. Installation of many common Unix-based tools requires the <a href="http://en.wikipedia.org/wiki/GNU_Compiler_Collection"><span class="caps">GCC</span> compiler</a>. The Xcode Command Line Tools include a <span class="caps">GCC</span> compiler. This article shows how to install Xcode Command Line Tools to use the <span class="caps">GCC</span> compiler and more.</p>
<h4>Installing Ruby on Rails</h4>
<p>If you are setting up your computer for developing web applications with Ruby on Rails, see this article for complete instructions:</p>
<p><a href="http://railsapps.github.io/installrubyonrails-mac.html"><strong>Install Ruby on Rails – macOS Sierra</strong></a></p>
<h2>Summary</h2>
<ol>
<li>Step 1. Upgrade Your System to macOS Sierra</li>
<li>Step 2. Open the Terminal Application</li>
<li>Step 3. Is XCode Already Installed?</li>
<li>Step 4. Enter Commands</li>
<li>Step 5. Install XCode Command Line Tools</li>
<li>Step 6. Verify Installation</li>
</ol>
<h2>MacOS Sierra</h2>
<p>To install the newest Xcode Command Line Tools, you’ll need the latest version of macOS. If you’ve owned your Mac for several years and haven’t updated macOS, be prepared to spend several hours updating the operating system.</p>
<p>See Apple’s instructions <a href="http://www.apple.com/osx/how-to-upgrade/">How to upgrade to macOS Sierra</a>. You can install macOS 10.12 Sierra from the Mac App Store for free. Allow plenty of time for the download and installation (it may take several hours).</p>
<h3>If You Updated to macOS Sierra</h3>
<p>If you updated to macOS Sierra from an earlier version of macOS, and you previously installed Xcode Command Line Tools, you will need to install the new version of Xcode Command Line Tools as described here.</p>
<p>If you previously installed the full Xcode package, you will need to update Xcode to the newest version (Xcode 8 or newer). After updating Xcode, launch and run the Xcode application and accept the Apple license terms.</p>
<h2>Terminal Application</h2>
<p>The <a href="http://en.wikipedia.org/wiki/Terminal.app">Terminal application</a> or <em>console</em> gives us access to the Unix command line, or <em>shell</em>. We call the command line the shell because it is the outer layer of the operating system’s internal mechanisms (which we call the kernel).</p>
<p>Find the macOS Terminal application by using the Command-Spacebar combination and searching for “Terminal.” It’s in the <strong>Applications/Utilities/</strong> folder.</p>
<p>Try out the terminal application by entering a shell command:</p>
<pre>
$ whoami
</pre>
<p>Don’t type the <code>$</code> character. The <code>$</code> character is a cue that you should enter a shell command. This is a longtime convention that indicates you should enter a command in the terminal application. The Unix shell command <code>whoami</code> returns your username.</p>
<p>To learn more about Unix shell commands, read <a href="http://cli.learncodethehardway.org/book/">The Command Line Crash Course</a>.</p>
<h2>Is Xcode Already Installed?</h2>
<p>You don’t need the full Xcode package to get the Xcode Command Line Tools. You only need the full Xcode package if you are doing development of applications for the Apple operating systems. However, you may have previously installed the full Xcode package.</p>
<p>Check if the full Xcode package is already installed:</p>
<pre>
$ xcode-select -p
</pre>
<p>If you see:</p>
<pre>
/Applications/Xcode.app/Contents/Developer
</pre>
<p>the full Xcode package is already installed.</p>
<p>You will need to update Xcode to the newest version (Xcode 8 or newer). Go to the App Store application and check “Updates.” After updating Xcode, be sure to launch the Xcode application and accept the Apple license terms.</p>
<p>If you intend to install Ruby using <span class="caps">RVM</span>, and you see a file location that contains spaces in the path:</p>
<pre>
/Applications/Apple Dev Tools/Xcode.app/Contents/Developer
</pre>
<p>you must delete Xcode. <a href="http://rvm.io/support/faq#can-i-use-a-path-with-spaces"><span class="caps">RVM</span> cannot accommodate spaces in a path</a> so <span class="caps">RVM</span> will fail when you attempt to install Ruby. You can either install only the Xcode Command Line Tools (instructions below) or reinstall the full Xcode package.</p>
<h2>Install Xcode Command Line Tools</h2>
<p>MacOS Sierra will alert you when you enter a command in the terminal that requires Xcode Command Line Tools. For example, you can enter <code>gcc</code> or <code>make</code>.</p>
<p>Try it. Enter:</p>
<pre>
$ gcc
</pre>
<p>You’ll see an alert box:</p>
<p><img src="http://railsapps.github.io/images/installing-mavericks-popup.png" title="alert Xcode Command Line Tools is required" alt="alert Xcode Command Line Tools is required"></p>
<p>Alternatively, you can use a command to install Xcode Command Line Tools. It will produce a similar alert box. Note the double hyphen:</p>
<pre>
$ xcode-select --install
</pre>
<p>Click “Install” to download and install Xcode Command Line Tools.</p>
<p>The instructions in the alert box are confusing. You don’t need to "Get Xcode" from the App Store. Just click "Install" for the Xcode Command Line Tools. If you have a slow Internet connection, it may take many minutes.</p>
<p>If the download takes a very long time (over an hour) or fails, you can try an alternative. Go to
<a href="https://developer.apple.com/downloads/more">https://developer.apple.com/downloads/more</a>
and enter your Apple ID and password. You'll be asked to agree to the terms of the Apple Developer Program.
You'll see a list of software packages you can download. Look for the latest version of <em>Command Line Tools</em>
and click to download the <em>.dmg</em> file. Downloading the <em>.dmg</em> file is much faster than waiting for
the command-line-based download. Install the <em>.dmg</em> file by clicking on the package icon.
</p>
<p><img src="http://railsapps.github.io/images/installing-mavericks-download.png" title="downloading Xcode Command Line Tools" alt="downloading Xcode Command Line Tools"></p>
<p><img src="http://railsapps.github.io/images/imstalling-mavericks-installed.png" title="installed Xcode Command Line Tools" alt="installed Xcode Command Line Tools"></p>
<p>Verify that you’ve successfully installed Xcode Command Line Tools:</p>
<pre>
$ xcode-select -p
/Library/Developer/CommandLineTools
</pre>
<p>Just to be certain, verify that <code>gcc</code> is installed:</p>
<pre>
$ gcc --version
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin14.0.0
Thread model: posix
</pre>
<p>On earlier versions of macOS, it was more difficult to install Xcode Command Line Tools. It required a huge download of the full Xcode package from the Mac App Store or registration as an Apple developer for a smaller Command Line Tools package. Mac OS X Mavericks made installation of Xcode Command Line Tools much simpler.</p>
<h3>Alternatives</h3>
<p>The <a href="https://github.com/kennethreitz/osx-gcc-installer"><span class="caps">OSX</span> <span class="caps">GCC</span> Installer</a> is an open source project to provide the <span class="caps">GCC</span> compiler and related tools. In a recent blog post, <a href="http://kennethreitz.org/xcode-gcc-and-homebrew/">Xcode, <span class="caps">GCC</span>, and Homebrew</a>, the project maintainer recommends installing the Xcode Command Line Tools because the open source project is unable to duplicate the complete Apple package (notably, the Node software project isn’t supported).</p>
<h2>Start Coding!</h2>
<p>With the <span class="caps">GCC</span> compiler installed, you can install any Unix system tools you need for software development.</p>
<p>To install Rails, see the article <a href="http://railsapps.github.io/installrubyonrails-mac.html">Install Ruby on Rails – macOS</a>.</p>
<p>Want to learn Ruby on Rails? See <a href="http://railsapps.github.io/what-is-ruby-rails.html">What is Ruby on Rails?</a>, the book <a href="http://learn-rails.com/learn-ruby-on-rails.html">Learn Ruby on Rails</a>, and recommendations for a <a href="https://tutorials.railsapps.org/rails-tutorial">Rails tutorial</a>.</p>
<h3><a href="http://learn-rails.com/learn-ruby-on-rails.html"><img src="http://railsapps.github.io/images/learn-rails-cover-130x161.jpg" title="Learn Ruby on Rails" alt="Learn Ruby on Rails"></a></h3>
<h2>Credits</h2>
<p>Daniel Kehoe wrote the article.</p>
</div>
<div class="comments" id="comments">
<div class="content wikistyle gollum">
<h2>Comments</h2>
</div>
<p>Is this helpful? Your encouragement fuels the project. Please tweet or add a comment. Couldn't get something to work? For the example apps and tutorials, it's best to open an issue on GitHub so we can help you.</p>
<div id="disqus_thread"></div>
<script type="text/javascript">
/* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
var disqus_shortname = 'railsapps'; // required: replace example with your forum shortname
/* * * DON'T EDIT BELOW THIS LINE * * */
(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
<a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>
</div><!-- class="comments" -->
</div><!-- class="columns" -->
</div><!-- class="row" -->
<footer class="row">
<div class="large-12 columns">
<div class="row">
<div class="medium-4 large-4 columns">
<dl class="footer_nav">
<dt>RailsApps · Getting Started</dt>
<dd><a href="http://railsapps.github.io/ruby-and-rails.html">Ruby on Rails</a></dd>
<dd><a href="http://railsapps.github.io/what-is-ruby-rails.html">What is Ruby on Rails?</a></dd>
<dd><a href="http://learn-rails.com/learn-ruby-on-rails.html">Learn Ruby on Rails</a></dd>
<dd><a href="https://tutorials.railsapps.org/rails-tutorial">Rails Tutorial</a></dd>
<dd><a href="http://learn-rails.com/ruby-on-rails-tutorial-for-beginners">Ruby on Rails Tutorial for Beginners</a></dd>
<dd><a href="http://railsapps.github.io/installing-rails.html">Install Ruby on Rails</a></dd>
<dd><a href="http://railsapps.github.io/installrubyonrails-mac.html">Install Ruby on Rails - macOS</a></dd>
<dd><a href="http://railsapps.github.io/installrubyonrails-ubuntu.html">Install Ruby on Rails - Ubuntu</a></dd>
<dd><a href="http://railsapps.github.io/rubyonrails-nitrous-io.html">Ruby on Rails - Nitrous.io</a></dd>
<dd><a href="http://railsapps.github.io/updating-rails.html">Update Rails</a></dd>
<dd><a href="http://railsapps.github.io/rails-composer/">Rails Composer</a></dd>
<dd><a href="http://railsapps.github.io/">Rails Examples</a></dd>
<dd><a href="http://railsapps.github.io/rails-examples-tutorials.html">Rails Starter Apps</a></dd>
</dl>
</div>
<div class="medium-4 large-4 columns">
<dl class="footer_nav">
<dt>RailsApps · Articles</dt>
<dd><a href="http://railsapps.github.io/rails-authorization.html">Rails Authorization</a></dd>
<dd><a href="http://railsapps.github.io/rails-google-analytics.html">Analytics for Rails</a></dd>
<dd><a href="http://railsapps.github.io/rails-heroku-tutorial.html">Heroku and Rails</a></dd>
<dd><a href="http://railsapps.github.io/rails-javascript-include-external.html">JavaScript and Rails</a></dd>
<dd><a href="http://railsapps.github.io/rails-environment-variables.html">Rails Environment Variables</a></dd>
<dd><a href="http://railsapps.github.io/rails-git.html">Git and Rails</a></dd>
<dd><a href="http://railsapps.github.io/rails-github.html">Rails GitHub</a></dd>
<dd><a href="http://railsapps.github.io/rails-send-email.html">Send Email with Rails</a></dd>
<dd><a href="http://railsapps.github.io/rails-haml.html">Haml and Rails</a></dd>
<dd><a href="http://railsapps.github.io/rails-default-application-layout.html">Rails Application Layout</a></dd>
<dd><a href="http://railsapps.github.io/rails-html5-boilerplate.html">HTML5 Boilerplate for Rails</a></dd>
<dd><a href="http://railsapps.github.io/rails-3-2-example-gemfile.html">Example Gemfiles for Rails</a></dd>
<dd><a href="http://railsapps.github.io/rails-application-templates.html">Rails Application Templates</a></dd>
<dd><a href="http://railsapps.github.io/rails-product-planning.html">Rails Product Planning</a></dd>
<dd><a href="http://railsapps.github.io/rails-project-management.html">Rails Project Management</a></dd>
</dl>
</div>
<div class="medium-4 large-4 columns">
<dl class="footer_nav">
<dt>RailsApps · Tutorials</dt>
<dd><a href="http://railsapps.github.io/twitter-bootstrap-rails.html">Rails Bootstrap</a></dd>
<dd><a href="http://railsapps.github.io/rails-foundation.html">Rails Foundation</a></dd>
<dd><a href="http://railsapps.github.io/rails-omniauth/">OmniAuth Tutorial</a></dd>
<dd><a href="http://railsapps.github.io/tutorial-rails-devise.html">Rails Devise Tutorial</a></dd>
<dd><a href="http://railsapps.github.io/tutorial-rails-devise-rspec-cucumber.html">Devise RSpec</a></dd>
<dd><a href="http://railsapps.github.io/tutorial-rails-bootstrap-devise-cancan.html">Devise Bootstrap</a></dd>
<dd><a href="http://railsapps.github.io/rails-devise-roles">Role-Based Authorization</a></dd>
<dd><a href="http://railsapps.github.io/rails-devise-pundit">Rails Authorization with Pundit</a></dd>
<dd><a href="https://tutorials.railsapps.org/rails-stripe-membership-saas">Rails Membership Site with Stripe</a></dd>
<dd><a href="https://tutorials.railsapps.org/rails-recurly-subscription-saas">Rails Subscription Site with Recurly</a></dd>
<dd><a href="https://tutorials.railsapps.org/rails-prelaunch-signup">Startup Prelaunch Signup Application</a></dd>
</dl>
<dl class="footer_nav">
<dt>RailsApps Profile</dt>
<dd><a href="https://plus.google.com/108039160165742774777?rel=author">Google</a></dd>
<dd><a href="https://plus.google.com/117374718581973393536" rel="publisher">Find us on Google+</a></dd>
</dl>
</div>
</div>
</div>
</footer>
<script type="text/javascript">
(function() {
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
po.src = 'http://apis.google.com/js/plusone.js?onload=onLoadCallback';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
})();
</script>
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/foundation/5.2.2/js/foundation.min.js"></script>
<script>
$(document).foundation();
</script>
</body>
</html>