command line tools for xcode что это

How to Install Xcode Command Line Tools on a Mac

Developers need to install Xcode Command Line Tools before they can develop software on a Mac.

Apple provides a complete development environment for programmers named Xcode. If you are developing software for macOS, iOS, tvOS, and watchOS, you must install the full Xcode application.

It’s not pre-installed, but you can install it from the Apple developer website or the App Store on your Mac.

What are Xcode Command Line Tools?

If you’re not developing software for an Apple device, you won’t need the full Xcode application (it requires over 40GB of disk space!).

Instead, you’ll install Xcode Command Line Tools. It’s a smaller package for software developers with tools that run on the command line, that is, in the Terminal application.

Programmers have used these tools on Unix operating systems since computing’s beginnings, and they serve as the foundation of almost all software development.

Luckily, the Xcode Command Line Tools package only requires 1.2GB of space on your disk.

You have three choices to install Xcode Command Line Tools on a Mac:

I don’t recommend installing the full Xcode package unless you’re developing software for an Apple device. The download will take too long and it will consume unnecessary disk space. Instead, try either of two faster methods.

How to Install Xcode Command Line Tools from a Command Prompt

Apple has made it easy to install Xcode Command Line Tools because certain commands will prompt you to begin installation.

Here are examples of commands that will trigger a prompt to install Xcode Command Line Tools:

Running any of these commands in the terminal will bring up a prompt to install Xcode Command Line Tools. I’ve written elsewhere about How to Open Terminal on MacOS – just click the Spotlight icon in the menu bar and type “terminal.”

Click ‘Install’ to begin the download and installation process.

Installation takes 8 minutes on a 2021 Mac M1 Mini, with a 100Mbps Internet connection. It’s significantly slower on Mac Intel over a slow Internet connection.

You’ll see a confirmation message when installation is complete.

Verify that you’ve successfully installed Xcode Command Line Tools:

You should see the following:

How to Use Homebrew to Install Xcode Command Line Tools

As easy as it is to use the command prompt to install Xcode Command Line Tools, I recommend an even easier method: using Homebrew.

This option was only recently added to Homebrew, so many developers are not aware of it.

Homebrew is the popular Mac package manager. Most developers need programming languages and utilities that don’t come installed on macOS and are not included in the Xcode Command Line Tools package. Homebrew can install almost any open-source tool for developers.

Since you’ll probably need Homebrew, you might as well let Homebrew install Xcode Command Line Tools for you.

First, check if Homebrew is already installed.

If Homebrew is not installed, you will see:

Homebrew provides an installation script you can run with a single command (check that it hasn’t changed at the Homebrew site).

The Homebrew installation script will ask you to enter your Mac user password. This is the password you use to sign in to your Mac.

You won’t see the characters as you type. Press enter when you are done.

If you haven’t already installed Xcode Command Line Tools, you’ll see a message that «The Xcode Command Line Tools will be installed.» Press return to continue when prompted by the Homebrew installation script.

You’ll see diagnostic and progress messages. Homebrew installation takes 2 to 15 minutes on a 2021 Mac M1 Mini, with a 100Mbps Internet connection. It’s significantly slower on Mac Intel over a slow Internet connection.

/.zprofile file that contains a command which sets up Homebrew. Homebrew shows instructions at the end of the installation process:

After you’ve installed Homebrew, check that Homebrew is installed properly.

You should see this:

If Homebrew is successfully installed, there will be Homebrew files in /usr/local (for macOS Intel) or /opt/homebrew (for Apple Silicon).

Now you have both Xcode Command Line Tools and Homebrew installed. If you want to learn more about adding Homebrew packages to set up your development environment, see Install a Homebrew Package.

More information

I’ve written an in-depth guide to Install Xcode Command Line Tools that goes beyond these basics.

There’s also a complete guide to Install Homebrew for Mac that explains how to Update Homebrew, Uninstall Homebrew, and keep up with other Housekeeping for Homebrew.

Your development environment

MacOS is the most popular platform for software development because the operating system is based on Unix, the longtime standard for software development.

With Xcode Command Line Tools installed, you’ll have a solid foundation for adding almost any open source development tool.

Add Homebrew and you have a package manager that can install version managers, programming languages, and almost any other tool you may need.

Combined with a text editor and terminal application, you’ll be prepared for any tutorial you’ll find on freeCodeCamp.

Author of the book «Learn Ruby on Rails.” Now at Yax.com, building websites without frameworks or build tools. Past founder of the RailsApps open source project.

If you read this far, tweet to the author to show them you care. Tweet a thanks

Learn to code for free. freeCodeCamp’s open source curriculum has helped more than 40,000 people get jobs as developers. Get started

freeCodeCamp is a donor-supported tax-exempt 501(c)(3) nonprofit organization (United States Federal Tax Identification Number: 82-0779546)

Donations to freeCodeCamp go toward our education initiatives and help pay for servers, services, and staff.

Источник

Building from the Command Line with Xcode FAQ

Building from the Command Line with Xcode FAQ

This document provides answers to frequently asked questions about command line tools.

What is the Command Line Tools Package?

The Command Line Tools Package is a small self-contained package available for download separately from Xcode and that allows you to do command line development in macOS. It consists of the macOS SDK and command-line tools such as Clang, which are installed in the /Library/Developer/CommandLineTools directory.

Читайте также:  что делает лаборант в бассейне

Downloading command-line tools is not available in Xcode for macOS 10.9. How can I install them on my machine?

In macOS 10.9 and later, the Downloads pane of Xcode Preferences does not support downloading command-line tools. Use any of the following methods to install command-line tools on your system:

Listing 1 Using xcrun to run dwarfdump in the Terminal application.

Download the Command Line Tools package from the Developer website

Figure 1 Download page for the Command Line Tools package.

Note: In macOS 10.9 and later, Software update notifies you when new versions of the command-line tools are available for update.

Install the Command Line Tools package via the Terminal application

How can I uninstall the command-line tools?

Xcode includes all of the command-line tools. If it is installed on your system, remove it to uninstall the command-line tools.

If the /Library/Developer/CommandLineTools directory exists on your system, remove it to uninstall the command-line tools.

I have multiple versions of Xcode installed on my machine. What version of Xcode do the command-line tools currently use?

To find out what version of Xcode is being used by your tools, run the following command in Terminal:

Listing 2 Printing the version of Xcode currently used by the command-line tools.

How do I select the default version of Xcode to use for my command-line tools?

To select a default Xcode for your command-line tools, run the following command in Terminal:

is the path to the Xcode.app package you wish to use for development.

Listing 3 Setting the default Xcode version.

How do I build my projects from the command line?

See below for various xcodebuild usage. Be sure to navigate to the directory containing your project or workspace in Terminal before running any of the following commands.

To list all schemes in your workspace, run the following command in Terminal:

where is the name of your workspace.

Listing 4 Listing all schemes in the MyApplication workspace.

To list all targets, build configurations, and schemes used in your project, run the following command in Terminal:

where is the name of your project.

Listing 5 Listing all information about MyProject, an Xcode project.

To build a scheme in your project, run the following command in Terminal:

where and build are respectively the name of your scheme to be built and the action to be performed on your scheme.

Listing 6 Building the tvOS scheme.

To build your target with a configuration file, run the following command in Terminal:

where and are respectively the name of your target to be built and the name of your configuration file. See Xcode Help’s Build configuration file reference for more information about xcconfig files.

Listing 7 Building the iOS target with a configuration file.

Listing 8 Setting up a location for iOS’ debug app version.

Listing 9 Setting up a location for iOS’s released app version.

My app has multiple build configurations. How do I set a default build configuration for xcodebuild?

Figure 2 Debug set as the default build configuration for xcodebuild.

How do I run unit tests from the command line?

xcodebuild provides several options for running unit tests.

To build and run unit tests from the command line, execute the following command in Terminal:

To build unit tests without running them from the command line, execute the following command in Terminal:

To run unit tests without building them from the command line, execute any of the following command in Terminal:

The test action requires specifying a scheme and a destination. See How do I implement the Build For Testing and Test Without Building features from the command line? for more information about build-for-testing and test-without-building actions.

Note: See Xcode Scheme and Run your app in Simulator for more information about scheme and destination, respectively.

Источник

How to install Xcode command line tools on a Mac?

Before we start

Having spent some years coding applications for macOS we’ve created a tool that everybody can use. The all-round problem fixer for Mac.

So here’s a tip for you: Download CleanMyMac to quickly solve some of the issues mentioned in this article. But to help you do it all by yourself, we’ve gathered our best ideas and solutions below.

Features described in this article refer to the MacPaw site version of CleanMyMac X.

Today, Mac users with new operating systems in place can now install Command Line Tools from the Xcode IDE without needing to install the entire Xcode package, or opening an Apple developers account.

Did you know: Using Xcode app leaves behind a lot of junk files a.k.a. «development junk.» These files are usually hidden from view but you can delete them with a Mac maintenance app CleanMyMac X.

In this article, we cover how you can install this optional and highly useful Command Line Tools package.

X code 11. Credit: developerinsider

What is the Xcode Command Line Tools package?

For Mac power users — we wouldn’t recommend downloading this unless you are comfortable with Terminal — the Xcode Command Line Tools package gives you a complete Unix toolkit accessible through Terminal. No developer account needed and you don’t need to download the entire — and quite large Xcode package of executables.

Within the Xcode Command Line toolkit, Mac users gain access to numerous useful tools, utilities, and compilers, including make, GCC, clang, perl, svn, git, size, strip, strings, libtool, cpp, and many others. All of these commands are a default part of Linux systems and programs.

Читайте также:  classpnp sys что за драйвер

We recommend following these steps for those with the following operating systems running on a Mac: macOS 10.13 High Sierra, macOS 10.14 Mojave, and macOS 10.15 Catalia onward. It isn’t always possible to download these Xcode Command Line Tools, following these steps, on Mac’s running older operating systems. Other ways to install command tools and gcc (without needing Xcode) is available through the Apple Developer website.

Here is how you install Xcode Command Line Tools.

How to install Xcode Command Line Tools?

Alternative way to install command line tools

If the Terminal combination didn’t work, open the Finder > Go to Folder. menu.
Paste in the following path: /System/Library/CoreServices

In that location, find the app called Install Command Line Developer Tools.app — it will have a blue globe icon.
Click this app and then try the Terminal method explained above.

With this new download, you should have access to 61 Unix command line tools. For example, one of the advantages of having these tools is you can install new apps and software directly from the source code instead of needing to go through the package manager and usual download route.

To access or view everything you’ve now got, go to the following directory:

Please note, this is the root /Library of your macOS/OS X, not the

All of these tools can also be found in: /Library/Developer/CommandLineTools/usr/bin/

These tools like small executable apps (which they are):

What happens if I encounter problems downloading these?

If you get an error message that says “Can’t install the software because it is not currently available from the Software Update server”, it means you’ve already got the Xcode package on your Mac. Mac OS X 10.9 onward, Xcode was already installed, which is why you aren’t able to download these tools. However, what you can do is uninstall the entire Xcode app if you’d prefer to only access these tools and not a whole load of software that isn’t going to be of much use.

Watch out for Xcode junk

The Xcode junk is one of those types of clutter that is keeps accumulating in remote places on your Mac. It could take up a few gigs of your space. The only app that seems to address this problem is CleanMyMac X by MacPaw. It’s loved by many Mac developers because it collects those specific types of development junk, like Xcode or outdated libraries.

Once you launch the app, click on System Junk > Scan. Then, click “Review Details”

CleanMyMac X is a powerful Mac performance improvement app. It makes your Mac as good as new. Let it scan your system and clear out any unwanted Xcode, development and system junk that is taking up too much space and cluttering up your Mac. In a few clicks, your Mac could be running smoother, quicker and more efficiently.

Источник

How to install Xcode Command Line Tools

How do I get the command-line build tools installed with the current Xcode/Mac OS X v10.8 (Mountain Lion) or later?

Unlike Xcode there is no installer, it’s just a bundle.

Is there a script I can run that will set-up my environment to support building from the command line?

16 Answers 16

Xcode 5.1 and OSX 10.9. (also works with Xcode 5.1.1 + OSX 10.10)

Xcode 5.0.1 and OSX 10.9

With Xcode 5.0.1 and Mavericks 10.9 the command line tool is no longer available through Xcode. Instead they must be downloaded from the Apple Developer Tools site: https://developer.apple.com/downloads/index.action. This requires signing in with a developer account.

Running the command in terminal produces the following GUI:

Inside Xcode (5.0)

Xcode includes a new «Downloads» preference pane to install optional components such as command line tools, and previous iOS Simulators. To open this pane click the «Xcode» button in the top left of the screen near the Apple logo, then click «Preferences», then click «Downloads».

Xcode 5.0 screenshot:

Xcode 4.x screenshot:

Separate Download

If you do not have Xcode, they are available as a separate download from Apple:

Источник

Xcode install (on MacOS)

Xcode IDE contain Command-Line utilities. But separate Command-Line installer cause errors for use by Homebrew, Python, and other development tools

This tutorial describes the installation and usage of Apple’s Xcode set of utilities for macOS developers.

Xcode is Apple’s free app for developing custom programs for all Apple devices (macOS, iPhone, iPad, Apple Watch). Increasingly, Machine Learning developers are using the Swift language.

BTW Xcode only works on macOS. There is no Windows PC version.

About Xcode

Otherwise, read on for a run-around.

Use an internet browser to view 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.”.

BTW the “Apple platforms” include MacOS, iPhone, iPad, Apple TV, and Apple Watch.

Xcode does not come with macOS because of its large size and because many users of macOS don’t need it to do software development.

Developers who use another IDE (such as Visual Studio, Eclipse, etc.) would only need to install Xcode’s command line utilities for the GCC compiler Python needs to build code.

PROTIP: Newer versions of Xcode installer also installs a Git client.

Overlapping installers

Imagine a Venn diagram of overlapping circles:

The Xcode IDE, which can be installed on a Terminal command line interface (CLI) or

Читайте также:  пурпур ударение на какой слог

Either way, Xcode contains:

PROTIP: Xcode IDE cannot be installed if Command Utilities has already been installed.

However, you can switch:

sudo xcode-select –switch /Applications/Xcode.app/Contents/Developer

So choose which one you want installed.

What Has Been Installed?

In a Terminal window, find out what has been installed:

That’s the same command as:

If the Xcode-select command is not found, choose to either install Command Line Tools or install the full Xcode IDE.

You have Command Line Tools installed and not the full Xcode if you see the path where CommandLineTools are installed:

If all you need is Command Line Tools, you’re good to go.

Alternately, if the full Xcode was installed, you would instead see:

Get a list of its folders if Xcode IDE was installed:

The response would be:

Delete first

PROTIP: If you want the full Xcode IDE when you have the Command Line Tools installed, first uninstall Command Line Tools

More version information

Xcode Version

From within a Terminal, type:

If Command Line Tools was installed, you would see:

If Xcode is installed, you would get a version code that should match up with the Build Number on the Apple web page:

For a more precise version number and other info (macOS Mavericks version and up):

A sample response, at time of writing:

The previous command was constructed based on a search of tools package names:

Get the version of GCC installed:

If Xcode was installed, you would see (at time of writing):

Previously, it was instead:

If Command Line Utilities is installed, you would see (at time of writing):

Identify the path where the make utility Java uses:

a. If Xcode is installed, the response is:

b. If Command Line Utilities is installed, the response is:

c. If no Xcode is installed:

Swift version

Get the version of the Swift program used to develop iOS mobile apps:

Sample response at time of this writing:

If jamf installed Xcode, you’ll also see:

The above appears regardless of whether Command Line Utilities or Xcode is installed.

From here, uninstall and install Command Line Tools or install the full Xcode IDE.

UnInstall Command Line Tools

PROTIP: This is also how you upgrade Command Line Tools.

Go to the parent folder where Command Line Tools is installed:

Get a list of its folders:

If Command Line Tools were installed, the response would be :

Remove all files in that folder, which requires a password for elevated permissions to get all the files:

The response is a lot of files removed (to the Trash).

Now you can choose to either install Command Line Tools or install the full Xcode IDE.

Install Command Line Utilities only

To install Command Line Utilities:

You should see this pop up:

Manually click “Install”, “Agree”, then “Install” to the “Updates Available” pop-up.

NOTE: The xGB download takes 13 minutes on a 10mbps line.

When you see “The software was installed.”, click “Done” to dismiss the pop-up.

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

Xcode IDE install from Terminal

Make sure you have at least 13GB free on your hard-drive before attempting installation.

In an internet browser, get to the “Mac App Store Preview” for Xcode at
https://apps.apple.com/us/app/Xcode/id497799835?mt=12

Click View in Mac App Store, then “Open App Store.app” in the pop-up.

Provide your Apple ID and password. Get one if you don’t already have one.

PROTIP: DO NOT install a beta version of Xcode.

The blue “OPEN” icon appears at the upper-right when the app is installed. But don’t click it because we are done.

In Finder, look for Xcode.app in the /Applications folder.

Alternately, on the Touchpad pinch 4 fingers together to click the App Store. Type enough of “Xcode” to filter out others.

To view the version, cursor to the top of the screen and click the program name next to the Apple icon to select “About Xcode”:

A) Initial install from Terminal CLI

The response on Catalina version of macOS:

Click the Apple icon at the upper-right corner and select “Shut Down…”.

After starting again

Set Apple’s licensing agreement bit:

Manually agree to the terms.

Get the version number of the new version.

B) Initial IDE install using web App Store

Sign in to Apple Developer with your email address then click the arrow icon. Enter your password, then click the arrow icon.

Below is the “Software Update” approach:

You’ll need to establish an Apple ID if you haven’t already.

Click the cloud icon Download and provide your Apple ID.

Go through Apple’s location verification if prompted.

Confirm your account.

Click “Allow” to the pop-up “Do you want to download?”.

Xcode size

CAUTION: Make sure that your machine has enough free space available.

These are massive files that may take a while to download if you don’t have a fast internet connection.

NOTE: Each version of Xcode is related to a specific version of the Apple OS Mac operating system.

Switch to Finder Downloads folder to watch progress on the file name ending with “Download”. The one with a clock icon which signifies downloading.

Return to the versions instructions above to view the updated version.

Delete the installer after you’re done, to reclaim disk space.

Xcode IDE Upgrade

Over time, Apple updates Xcode and its command line utilities.

Click the Apple icon, then click System Preferences. Here is an example notification:

Xcode FileMerge tool

Xcode graphically compares files and directories.

Open Xcode. This takes a few seconds.

Right-click on Xcode icon. Select “Open Developer Tool”. Select “FileMerge”.

Источник

Сказочный портал