Install Xcode For Mac Catalina

Had the same issue after updating my MacBook to Big Sur and trying to update Xcode to version 12.5. Tried to reinstall, reboot my Mac, delete the app and install it again from App Store. Decided to leave the installation overnight and it helped! In the morning Xcode was installed successfully.

  1. Install Xcode Mac Terminal Catalina
  2. Install Xcode For Mac Catalina 2019
  3. Install Xcode For Mac Catalina Free
  • Download Xcode for macOS 11.0 or later and enjoy it on your Mac. ‎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.
  • Wait for the Xcode Command Line Tools package to install. It is around 130 MB and usually installs fairly quickly; although it depends on your connection. Once everything is installed, the installer goes away and you should be able to any of the new commands that you’ve now got access to. Enjoy using your new Unix command line tools!
Install Xcode For Mac Catalina

When you try to build xdebug on macOS Catalina you will get errors like these:

Configure and build xdebug on macOS Catalina

The reason for these errors is that the /usr/include folder is missing because Apple removed it when they released Xcode 11.

But, you can work around this problem. Here is how:

First, you need to make sure that Xcode and the command line tools installed. Open a terminal window and run the following command to display the SDK path:

This command should output something like this:

Install Xcode Mac Terminal Catalina

If not, install the command-line tools with executing:

and follow the instructions. After the installation is finished, start Xcode App to make sure the installation is done.

Now try to display the SDK-Path again:

The php tools needed to compile an extension try to use this missing include folder. We will create a modified version of phpize and php-config which will use the includes from the macOS SDK. First we will copy phpize and php-config and then we will modify these copies with a patch.

We create a new folder in your home directory under /Users/YOUR-USERNAME with the name 'php-private'..

Now copy phpize and php-config to php-private

Now determine which PHP version is installed on your system by executing

You should get something like this

I have prepared two patches to simplify the process. Download the two files and save them in your Downloads folder.

Download the phpize patch phpize-catalina.patch.zip and save it. The contents of the patch file for reference:

For PHP 7.3.9 Download the php-config patch php-config-7.3.9-catalina.patch.zip and save it.

For PHP 7.3.11 Download the php-config patch php-config-7.3.11-catalina.patch.zip and save it.

The contents of the patch file for reference:

Extract the compressed patch files.

PHP 7.3.9:

PHP 7.3.11:

Now we patching our copy of phpize and php-config

PHP 7.3.9:

PHP 7.3.11:

Install Xcode For Mac Catalina

We are ready to compile xdebug

Create a working directory in your home folder. We will build xdebug here

Download xdebug from Xdebug.org and save in under Downloads.

Copy the archive to the working directory and extract it.

Now, we run our patched phpize in the xdebug folder.

When everything went good, you get something like this:

If so, you can skip the next part and continue with configuring and installing Xdebug.

Errors like these means, you need to install some requirements.

If phpize prints lines like these, you need to install autoconf:

To install autoconf, execute the following commands:

Now run our patched phpize in the xdebug folder again.

Check the output, and if everything went good, continue.

Configure and build xdebug:

Now we will find the full path to our patched php-config. This can be done like this:

The output will something like:

Replace '/Users/YOUR-USERNAME/php-private/php-config' with the output of the above command and configure xdebug by executing:

In the output of configure you will see that the SDK path is being used:

Now build the extension

We don't executing 'make install' to install xdebug.so because the macOS System Integrity Protection (SIP) will not allow us to install xdebug to the /usr/lib/extensions folder. To workaround this, we install the extension under the /usr/local folder.

Install

Now edit your php.ini (usually under /etc/php.ini) to load the right xdebug. PHP searches for extensions in its default extension directory. Our xdebug resides outside of this directory, so we have to specify the full path:

To test it, execute:

The output should begin like this:

Restart your apache web server to activate your changes

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:

  • install the full Xcode package
  • install Xcode Command Line Tools when triggered by a command
  • install Xcode Command Line Tools as part of a Homebrew installation.

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:

  • clang – a compiler that turns source code into an executable program
  • gcc – the GNU compiler
  • git – the save-as-you-go version control system

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.”

You can also enter the command xcode-select --install in the terminal to begin the installation process. You'll see a panel that asks you to install Xcode Command Line Tools.

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.

Install Xcode For Mac Catalina 2019

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.

On Mac Intel machines, that's all you need to do – Homebrew is ready to use. On Mac Intel, Homebrew installs itself into the /usr/local/bin directory, which is already configured for access by the shell with the macOS default $PATH.

On Apple Silicon machines, there's one more step. Homebrew files are installed into the /opt/homebrew folder. But the folder is not part of the default $PATH. Follow Homebrew's advice and create a ~/.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.

In the guide, I explain how to check if Xcode Command Line Tools Are Already Installed. I go into more detail about how to Install Xcode Command Line Tools with Homebrew. Finally, I explain how to Uninstall Xcode Command Line Tools, Reinstall Xcode Command Line Tools, and provide a List of Xcode Command Line Tools that you can use.

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.

Mac

Install Xcode For Mac Catalina Free

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.