<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">\documentclass[onecolumn,letterpaper,11pt]{article}

%===================================================================
\input{common_latex/common_latex_packages}
\input{common_latex/common_latex_definitions}
\input{common_latex/common_latex_help_format}
%===================================================================

\begin{document}

\begin{labcover}
\labtitle{Help Topic: Installing XCode and Enabling Command Line Tools}
\vspace{0.1in}
\labdate{Spring 2020}
\vspace{0.1in}
\labauth{Michael Benjamin, mikerb@mit.edu}
\labauth{Department of Mechanical Engineering}
\labauth{MIT, Cambridge MA 02139}
\labline
\end{labcover}

\wikidoc{file=Help.OSXGetXCode}
\wikidoc{auth=mikerb@mit.edu}

%====================================================================
\section*{Installing XCode and Enabling Command Line Tools}
%====================================================================

This page concerns getting XCode on your Mac. It contains components,
like the C++ compiler, that will be essential for our purposes, so
we'll need to make sure it's installed on your machine.  On your
machine, it's possible that:

\begin{packed_itemize}[1]
\item XCode is properly installed but you just don't know it,
\item XCode is not at all on your machine.  
\end{packed_itemize}

\noindent
If you have a Mac provide by the 2.680 staff, and have just created
your own user account, the most likely scenario is the first one. In
any event, we'll soon find out.

%--------------------------------------------------------------------
\subsection*{Checking if XCode is already installed (using Finder)}

Finder is the Mac application that is running constantly and by
default upon login. To switch over to running Finder, just click
anywhere in the screen background outside an app. We'll use Finder to
find out if XCode is installed.

\begin{packed_itemize}
\item In Finder, select the Go pull-down menu, and select
  Applications. Or just use the short-cut key \var{Command-Shift-A}
  while Finder is active.
\item This should open a new Finder window, showing all the
  Applications installed on your machine.  Look for the XCode icon in
  the Applications folder. It is blue and has a little hammer. It should
  look something like:
\end{packed_itemize}

\vspace{0.1in}
\begin{figure}[H]
\centering
\includegraphics[width=0.85\textwidth]{figs_help/xcode_in_finder.png}
\caption{The Finder window, showing the XCode application, should
  look something like this.}
\label{fig_finder_xcode}
\end{figure}

\vspace{0.1in}
\noindent
After double-clicking on the XCode icon above, the XCode splash window
should appear, looking something like:

\vspace{0.1in}
\begin{figure}[H]
\centering
\includegraphics[width=0.75\textwidth]{figs_help/xcode_splash.png}
\caption{The XCode splash window typically will open when you launch
  XCode.}
\label{fig_splash_xcode}
\end{figure}

\vspace{0.1in}
\noindent
If you successfully found and launched XCode, go directly to the Section
\var{"Updating XCode"}.


\vspace{0.1in}
\noindent
If you {\bf did not find XCode} on your system, proceed to the
following Section \var{"Installing XCode"}.




%--------------------------------------------------------------------
\subsection*{Installing XCode}
\label{sec_xcode_install}

XCode is distributed by Apple. It is free but Apple wants you to sign
up as a developer to have access to XCode. This can be done
anonymously, but you have to do the following steps:

\begin{packed_itemize}[2]

\item Obtain an Apple ID if you haven't already. It is
  free. \urlx{https://appleid.apple.com}

\item Obtain XCode from the App Store. Even though it's free, this is
  still the way to install it on your computer. To access the App
  Store, you obviously will need to have a network connection.
\end{packed_itemize}

\vspace{0.1in}
\noindent
You can go to the App Store by clicking on the main Apple Menu at the very
top left of your screen, and selecing \var{App Store}. You can also
get there by selecting the App Store icon in your Dock if it is there.
The icon should look like:

\vspace{0.1in}
\begin{figure}[H]
  \centering 
  \includegraphics[width=0.07\textwidth]{figs_help/app_store.png}
  \caption{The App Store icon.}
\label{fig_app_store_icon}
\end{figure}

\begin{packed_itemize}[2]
\item Once you have launched the App Store, search on the term "XCode".
  You should see something like:
\end{packed_itemize}

\vspace{0.1in}
\begin{figure}[H]
  \centering 
  \includegraphics[width=0.75\textwidth]{figs_help/xcode_app_store_search.png}
  \caption{The XCode Application is found on the App Store.}
\label{fig_xcode_app}
\end{figure}

\vspace{0.1in}
\noindent
Presumably the button next to XCode will say \var{"GET"}, but it may
say \var{"UPDATE"} or \var{"OPEN"} if in fact it somehow was installed
but ecaped our attention when we were looking for it previously. If it
says \var{"GET"} or \var{"UPDATE"}, click on the button and go through
the steps to download or update the software. Once you are done, or if
the button said \var{"OPEN"}, proceed to the section \var{"Installing
  the XCode Command Line Utilities"}.

%--------------------------------------------------------------------
\subsection*{Updating XCode}

Even if XCode is installed on your machine already, we want to (a)
check if it needs to be updated, (b) install the command line
utilities. If you just now installed XCode as in the previous section,
you can skip this step and proceed to the Section \var{"Installing the
  XCode Command Line Utilities"}.

\vspace{0.1in}
\noindent
We check for available updates first since, if a new update is indeed
applied, the command line utilities may need to be re-installed
anyway. Note, some people may have their system configured to apply
updates automatically. But if you don't you need to periodically check
to see if updates are available and decide if the current moment
allows for the disruption of downloading and applying updates.

\vspace{0.1in}
\noindent
To check if an update is available for XCode, select the main Apple
pull-down menu from the upper-left corner of your screen. It may show
something like:

\vspace{0.1in}
\begin{figure}[H]
\centering
\includegraphics[width=0.4\textwidth]{figs_help/mac_updates_menu.png}
\caption{The Apple pull-down menu shows that there are currently
  6 applications that need to be update.}
\label{fig_mac_updates_menu}
\end{figure}

\vspace{0.1in}
\noindent
In the above case, there are 6 applications from the App Store (XCode
is obtained through the Apple App Store), that have updates
available. Select this menu item, and a window like the following
should appear.

\vspace{0.1in}
\begin{figure}[H]
\centering
\includegraphics[width=0.74\textwidth]{figs_help/xcode_updates.png}
\caption{In this case XCode is listed as needing an update.}
\label{fig_xcode_updates}
\end{figure}

\vspace{0.1in}
\noindent
If you see XCode in the list of apps that need to be updated, as
above, go ahead and select it by clicking on the \var{UPDATE} button
and following the instructions.

%--------------------------------------------------------------------
\subsection*{Installing the XCode Command Line Utilities}

XCode is quite large and there are a number of optional components
that may not be installed by default. One of these is the Command Line
Utilities. We will install this from the command line with:

\vspace{0.1in}
\begin{consoleverb}
$ xcode-select --install
\end{consoleverb}
\vspace{0.1in}

\noindent
Follow the instructions presented to you either on the command line, or
in a pop-up window. It may prompt you for your password. 

\vspace{0.1in}
\noindent
You should now have a pretty powerful developer environment ready to go!

\end{document}


</pre></body></html>