Xcode (install on MacOS)
This tutorial describes how to install several utilities needed by developers running HomeBrew, Python, and other programs on Macs:
-
— the C language compiler
cc
NOTE: Content here are my personal opinions, and not intended to represent any employer (past or present). “PROTIP:” here highlight information I haven’t seen elsewhere on the internet because it is hard-won, little-know but significant facts based on my personal research and experience.
TD;LR Overlapping installers!
Utilities needed can be obtained from two different folders, installed two different ways:
$HOME/Applications/Xcode.app ==> if installed using Apple’s Xcode IDE
/Library/Developer/CommandLineTools ==> if installed using CommandLineTools
Choose one. Developers using Mac Books but NOT developing apps to run on an Apple platform can install just the CommandLineTools.
Which one are you using?
Use Apple’s xcode-select command to identify where to find gcc and other Apple Developer utilities:
In a Terminal window, find out what has been installed:
-p is the same as –print-path
- If XCode CLI was installed, you should see:
- If XCode.app was installed, you should instead see:
- If the Xcode-select command is not found, choose to eitherinstall Command Line Tools or install the full Xcode IDE.
Path of gcc
To identify the path to one of the utilities (gcc), use the xcrun utility that comes with macOS:
If Command Line Utilities is installed, the response would be:
/Library/Developer/CommandLineTools/usr/bin/gcc
If Xcode.app is installed, the response would be:
/Applications/Xcode.app/Contents/Developer/usr/bin/gcc
If neither is installed:
The same for make and other utilities.
Again, if “Command not found” appears, either install CommandLineTools or install XCode.app, then return here.
Which version has been installed?
Verify the version of GCC installed:
If the response is “command not found”, it’s not installed.
If the program is using CommandLineTools, you would see (at time of this writing):
Previously, it was instead:
If Xcode.app was installed, you would see (at time of writing):
Files and Folders
Let’s see what is in those folders:
If CommandLineTools was installed:
The response would be:
If Xcode.app was installed:
The response would have more than what’s in CommandLineTools:
How many folders and files were installed?
If you have the tree utility installed:
Would yield (at time of writing):
See the link’s location using a Linux utility:
On an Intel Mac, the response is a path to the file at:
See it’s a binary executable if you view the file:
Press q to exit from the multi-page viewer.
Xcode.app Version
From within a Terminal, type:
If Command Line Tools was installed, you would see:
Xcode-select: error: tool ‘Xcodebuild’ requires Xcode, but active developer directory ‘/Library/Developer/CommandLineTools’ is a command line tools instance
If Xcode is installed, you would get a version code that should match up with the Build Number on Apple’s web page:
For a more precise version number and other info (macOS Mavericks version and up):
A sample response, at time of writing:
BTW The previous command was constructed based on a search of tools package names:
Specifying the XCode utility to use
PROTIP: Xcode.app cannot be installed if Command Utilities has already been installed. So the installation program needs to first check whether XCode.app or CommandLineTools is installed.
Choose which one you want to use:
To specify the use of Xcode.app (IDE):
To specify the use of CommandLineTools:
Install Command Line Utilities only
To install Command Line Utilities:
Alternately, this shell script which makes use of Apple’s osascript:
xcode-select: note: install requested for command line developer tools
Already installed?
xcode-select: error: command line tools are already installed, use “Software Update” in System Settings to install updates
UnInstall Command Line Tools
PROTIP: Deleting the “Command Line Tools” folder is also how to uninstall and reinstall.
Open a new window or tab shell in your Terminal app.
Go to the parent folder where Command Line Tools is installed:
Remove all files in that folder, provide a password for elevated permissions to get all the files:
Input your password when prompted.
The response is a lot of files removed (to the Trash).
CAUTION: On a Mac M1 (Apple Silicon chip, macOS 12.0 Monterey), after installed the Command Line Tools then uninstalled them by deleting /Library/Developer/CommandLineTools and running sudo xcode-select -r, I was still getting updates to the tools in System Preferences > Software Update.
The files below are protected by SIP: to delete them, I had to disable SIP first (ie disable SIP, delete the files, re-enable SIP).
Indeed, the receipts are at /Library/Apple/System/Library/Receipts, in the form of files:
- com.apple.pkg.CLTools_Executables.
- com.apple.pkg.CLTools_SDK_macOS*.
- com.apple.pkg.CLTools_macOS_SDK.
Software Update
To get to “Software Update”:
Click Settings. Click General. Click Software Update.
A shell script uses these commands to not require manual clicking on the dialog that pops up (below):
If you see this pop up, manually click “Install”, “Agree”, then “Install”. It says “Finding software”, then “Downloading software”. Finally, “Updates Available” appears.
CAUTION: The large number of files means this can a long time. It took 13 minutes on my 10mbps line.
When you see “The software was installed.”, click “Done” to dismiss the pop-up.
Set license
If you try to confirm the versions installed, you’ll see:
You have not agreed to the Xcode license agreements. You must agree to both license agreements below in order to use Xcode. Press the ‘return’ key to view the license agreements at ‘/Applications/Xcode.app/Contents/Resources/en.lproj/License.rtf’
Press spacebar several times until it says:
Agreeing to the Xcode/iOS license requires admin privileges, please run “sudo xcodebuild -license” and then retry this command.
Run the command suggested to set Apple’s licensing agreement bit:
Enter your password for the sudo.
About Xcode.app
Xcode is Apple’s free IDE developers use to create custom programs for an Apple platform.
There is no Windows PC version of XCode. XCode only works on macOS. This limitation has served to increase the need for MacBooks.
Increasingly, Machine Learning developers are using Apple’s Swift language.
Visit Apple’s Xcode marketing page at
Xcode “includes everything you need to create amazing apps for all Apple platforms. Now Xcode and Instruments look great in the new Dark Mode on macOS Mojave. The source code editor lets you transform or refactor code more easily, see source control changes alongside the related line, and quickly get details on upstream code differences. You can build your own instrument with custom visualization and data analysis. Swift compiles software more quickly, helps you deliver faster apps, and generates even smaller binaries. Test suites complete many times faster, working with a team is simpler and more secure, and much more.”.
PROTIP: Newer versions of Xcode installer also installs a Git client.
How big is the XCode installer?
To see how big the XCode installer is, visit Apple’s fancy “downloads” web page:
Scroll down to a version that doesn’t say “beta”.
Notice the size, such as “(7.01 GB)”.
Because XCode.app is several Gigabytes large, developers who do not create Apple programs can save disk space and time to install it by not installing it.
Also, installer size is also why Xcode does not come with macOS.
Since the Apple Store only handles individual .app files, other mechanisms are needed to install additional programs needed as a pre-requisite by Homebrew, Python, and other development programs.
Make sure you have at least 13GB free on your hard-drive before attempting installation.
- Click the Apple icon to select “About this Mac”.
- Click “Storage” tab.
There are other IDEs used by developers (such as Visual Studio, Eclipse, IntelliJ, PyCharm, etc.).
Xcode
Xcode — интегрированная среда разработки OS X и Apple. Первая версия выпущена в 2001 году . Стабильные версии распространяются бесплатно через Mac App Store. Зарегистрированные разработчики также имеют доступ к бета-сборкам через сайт Apple Developer
Содержание
Описание [ ]
Xcode включает в себя большую часть документации разработчика от Apple и Interface Builder — приложение, использующееся для создания графических интерфейсов.
Пакет Xcode включает в себя изменённую версию свободного набора GNU Compiler Collection и поддерживает языки Objective-C, Шаблон:Нп3 , AppleScript, Cocoa, [1] , Free Pascal [2] , [3] , [4] , [5] , [6] и D [7] . Пакет Xcode использует OpenSolaris , будет интегрирован в Xcode под названием Xray. Позже Xray был переименован в Instruments.
Xcode 4 [ ]
С 9 марта 2011 года стала доступна новая версия Xcode 4, причем в новую версию входят наборы SDK OS X 10.6 и SDK iOS 4.3 [8] . Впервые предварительный релиз Xcode 4 был показан на WWDC 2010.
В Xcode 4 был представлен новый пользовательский интерфейс: единое окно, куда встроен и Interface Builder , сам Xcode, Instruments, помощник, новая система анализа кода Debug Console с более сильным движком, облегчающая исправление ошибок и осуществляющая поиск логических проблем в коде. Программа также получила дополнительный компилятор Apple Xcode 5 [ ]
Xcode 6 [ ]
Xcode 7 [ ]
С 8 июня 2015 года стала доступна Interface Builder .
Xcode 8 [ ]
С 13 сентября 2016 года стала доступна бета-версия нового Xcode 8. В ней появилась поддержка iOS 10, Swift 3.0, обновленный и расширенный дебаггер.
Xcode 15
Xcode 15 enables you to develop, test, and distribute apps for all Apple platforms. Code and design your apps faster with enhanced code completion, interactive previews, and live animations. Use Git staging to craft your next commit without leaving your code. Explore and diagnose your test results with redesigned test reports with video recording. And start deploying seamlessly to TestFlight and the App Store from Xcode Cloud. Creating amazing apps has never been easier.
Ready, set, code.
Xcode 15 is now 50% smaller on the Mac App Store, with downloadable simulator runtimes for all platforms. Enhanced code completion helps you write safer code faster, now referencing all your assets. And projects build faster thanks to improvements in the compiler and a brand-new linker, optimized for the multicore architecture of Apple silicon.
Stay organized
The new Bookmark navigator helps you keep track of landmarks in your code and organize your tasks. Localization assets are streamlined in the new String Catalog, giving you a centralized way to review and update them. And documentation shines in Xcode 15, with a beautiful new design, and real-time preview.
Swift and SwiftUI
Swift, SwiftUI, and Xcode 15 work together as one. Powered by the new Swift macros, Xcode Previews are easier to use and now work across SwiftUI, UIKit, and AppKit. The new interactive timeline helps you develop and design your widgets. And working with different platforms and devices is easier: you can choose them right in the preview canvas to make sure your views look great everywhere.
Beyond debugging
Use the power of macros in the source editor, setting breakpoints and stepping into the generated code. Access debug output with ease using the structured console.
Xcode Cloud
Xcode 15 and Xcode Cloud work seamlessly together. Xcode Cloud is a continuous integration and delivery service built into Xcode and designed expressly for Apple developers. Start building your app in just a few minutes, with live build status, beautiful reports, and automatic distribution to your testers and users.
Get started
Download Xcode and use these resources to build apps for all Apple platforms.
Xcode documentation
Find details and step-by-step instructions on how to use Xcode.
Documentation
Browse the latest documentation, including tutorials, sample code, articles, and API reference.
Videos
Discover the latest in Apple technologies presented at WWDC and other events.
Forums
Ask questions and discuss development topics with Apple engineers and other developers.
Xcode 4+
Xcode includes everything developers need to create great applications for Mac, iPhone, iPad, Apple TV, and Apple Watch. Xcode provides developers a unified workflow for user interface design, coding, testing, and debugging. The Xcode IDE combined with the Swift programming language make developing apps easy and fun.
Xcode includes the Xcode IDE, Swift and C/C++/Objective-C compilers, Instruments analysis tool, simulators, the latest SDKs, and hundreds of powerful features:
Innovative tools help you create great apps
• Swift is an intuitive programming language that is safe, fast, and modern
• SwiftUI is a revolutionary framework to create user interfaces with a declarative Swift syntax
• Playgrounds are a fun way to experiment and interact with Swift code
• View debugging shows a 3D stack of all your app's UI view layers at runtime
• Split editors in virtually unlimited ways, show previews, or choose an assistant to see related content
• Live issues display errors as you type, and Fix-its improve your code with just a click
• Source control navigator and service integrations help you manage code across a team
SwiftUI and Interface Builder make it easy to design your interface
• SwiftUI uses declarative Swift code that clearly describes your interface
• Design canvas graphically builds UI views using the library of controls and modifyers
• Preview SwiftUI code or UIKit interfaces in different screen sizes, orientations, and font sizes
• SwiftUI code is always in perfect sync with the graphical design canvas and previews
• Animations are built using simple commands that describe the action you want to see
Professional editor and debugger keep your code front and center
• Refactoring makes it easy to modify the structure of Swift, Objective-C, C, and C++ code
• Open Quickly instantly opens any file within your project
• Data tips and Quick Look can inspect a variable by hovering your mouse over code while debugging
Instruments for performance analysis
• Compare CPU, disk, memory, and GPU performance as graphical tracks over time
• Identify performance bottlenecks, then dive deep into the code to uncover the cause
• Analyze your app directly, or sample the entire system with very little overhead
• Create custom instruments with unique visualizations to analyze your own code and frameworks
To test or run applications on an iPhone, iPad, Apple TV, or Apple Watch all you need is a free Apple ID. To submit your apps to the App Store you must be a member of the Apple Developer Program. Some features may require Internet access.