Utilities for Apple MacOS
Overview
This tutorial describes the installation and useage of Apple’s XCode set of utilities for developers.
XCode Install
To build Python on a machine requires a GCC compiler. One comes with command-line tools installed with Apple’s XCode IDE. Newer versions also installs a Git client.
“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 easier and more fun than ever
-
Get the installation location in a Terminal window:
xcode-select -p
The answer:
/Applications/Xcode.app/Contents/Developer
It used to be that one can enter a command:
xcode-select --install
The response on my Sierra machine is:
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
So below is the “Software Update” approach:
-
Use an internet browser to https://developer.apple.com/xcode
-
Provide your Apple ID and password. Get one if you don’t already have one.
-
Go through Apple’s location verification if prompted.
-
Click the blue “Download” and provide your Apple ID. You’ll need to establish an Apple ID.
-
Select the version to download:
File Date Download Unpacked XCode_9.0 2017-09-19 . ? GB ? GB XCode_8.3.2. 2017- . ? GB ? GB XCode_8.2.1 8C1002 2016-12-19 ? GB ? GB XCode_8_beta_2.xip 2016-07-05 5.9 GB 12.32 GB XCode_7.31 2016-05-03 3.8 GB ? XCode_4.1 2014- 2.9 GB ? XCode_3.2.4 2014- 2.? GB ? NOTE: These are massive files that may take a while to download if you don’t have a fast internet connection.
CAUTION: Even more important, make sure that your machine will have enough free space available.
-
Open App Store. Click Open.
-
Remember to delete the installer after you’re done, then
XCode version
-
Confirm the version installed.
/usr/bin/xcodebuild -version
The answer:
Xcode 8.2.1 Build version 8C1002
The should match up with the Build Number on the Apple web page.
Alternately, for a more precise version number and other info (Mavericks and up):
pkgutil --pkg-info=com.apple.pkg.CLTools_Executables | grep version
A sample response:
version: 8.3.2.0.1.1492020469
NOTE: Version 9 is available.
This is a specific version of:
pkgutil --pkgs | grep -i tools
The response for 8.3.2:
com.apple.pkg.CLTools_Executables com.apple.pkg.CLTools_SDK_OSX1012 com.microsoft.package.Proofing_Tools
The response earlier:
package-id: com.apple.pkg.CLTools_Executables version: 8.2.0.0.1.1480973914 volume: / location: / install-time: 1484969093 groups: com.apple.FindSystemFiles.pkg-group
-
Get the version of the GCC (C compiler) installed:
gcc --version
Sample answer:
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1 Apple LLVM version 8.1.0 (clang-802.0.42) Target: x86_64-apple-darwin16.7.0 Thread model: posix InstalledDir: /Library/Developer/CommandLineTools/usr/bin
-
XCode is used to develop iOS mobile apps using Swift. So let’s see:
swift -version
Target: x86_64-apple-macosx10.9
xcodebuild -version
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance