Run xcode-select -v to check what version you're running (mine is currently 2384 on macOS 11.1). Run #1409 (comment) to see if it helps to install the latest CLI Tools. Optional: Go to the App Store and install the latest XCode (12.3) if you can't get Ruby to compile. It should work with only the latest CLI tools though. How to install the Command Line Tools on macOS Catalina. Build C, C programs from Terminal. With the Catalina upgrade, my Xcode did not automatically update to 11.1. The App Store kept trying to update Xcode each night through automatic updates. On its own, it never succeeded. Once it reported it could not download Xcode: Unable to Download App. 'Xcode' could not be installed. Please try again later. Step Two – Install XCode on Windows. Once the macOS Catalina is installed, open it up and switch it on from VMware or VirtualBox. Next, open the App Store and search for XCode. XCode on App Store. On the results, click the XCode then click Get on this window. It will ask for your Apple ID, sign in and it will start.
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:
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:
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:
Catalina Install Xcode Command Line Tools
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.
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
Xcode is the tool developers use to build apps for the Apple ecosystem – MacOS, iOS, and all things Apple.
This guide will walk you through how to successfully install Xcode onto your Mac, from start to finish.
Here are some handy tips to know before you get started:
- Xcode only runs on a mac. If you are on a PC, sadly you won't be able to use Xcode.
- You'll need a good, stable internet connection. The latest version is around 8 gigabytes in size.
- Be sure to have at least 30 gigabytes of free space on your computer. The latest
.xip
file (v11.4.1 at the time of writing) is ~8 gigabytes zipped. When you unzip it, that's another 17 gigabytes. Then you'll need the command line tool, which is yet another 1.5 gigabytes.
Here's an overview of the steps to install Xcode
- Download Xcode
- Install the command line tool
- Open the new version
- Delete files
Note that I have listed some Terminal commands in the steps below. These commands can be typed into your present working directory. This means that you don't need to navigate to any particular folder.
If you really want to, you can first type cd
before typing the commands in the below steps. This will return you back to the home folder.
Step #1: Download Xcode
There are two ways to do this. For the latest version and a theoretically 'easy' installation, you can use the App Store. I don't recommend this option.
I prefer to use the developer site. This comes with the bonus option of being able to download any version you'd like.
Option #1: Download via the App Store for the latest version (not my preferred option)
In theory, this should be a seamless and pain-free process. But if the installation fails for any reason on the last step, it is very hard to troubleshoot.
There are a few reasons for failure, and no easy way to know which is the underlying cause. If you do encounter a failure, you will need to re-download the entire file again each time you try to fix the failure. As the latest version is 8 gigabytes, I didn't much enjoy this approach.
But if you're feeling brave, here are the steps:
- Open the App Store on your mac
- Sign in
- Search for Xcode
- Click install or update
Option 2: Download via the Developer site for a specific version (my preferred option)
- Head to the 'more' section of the Apple developer website
- Sign in with your iTunes account id
- Type in the version that you'd like, and download the
Xcode_x_x_x.xip
file. Keep in mind that Xcode 11.4.1 is 8 gigabytes, so this will take awhile depending on your internet connection. - Once the file is downloaded, click on
.xip
to extract it. Your laptop will extract it to the same folder you downloaded it to. This extraction process is automatic. You don't need to do anything more after you click on the.xip
file. This step will take a few minutes. - [Optional] Once extracted, rename the application to “Xcode11.x.x” if you are using multiple versions.
- Drag application to the Applications folder
- [Optional] Set the new Xcode version as the default. Open Terminal and type
sudo xcode-select -switch /Applications/Xcodex.x.x.app
. Replacex.x.x
with the version number. For example:Xcode11.4.1.app
. You will need to enter in your computer admin password. I'm pretty sure this will update the default Xcode version for all users on your computer, so best to check with other users first
Step #2: Install the command line tool (CLT)
If you have multiple users on your computer, you will need to update the CLT for each user.
Download .dmg
Catalina Xcode Install Fails
To update the CLT, go to app developer website and download the command line tool .dmg
.
If you have never installed Xcode before, you may be able to update with your Terminal by typing in xcode-select --install
instead of visiting the developer website.
But if you have an existing version of Xcode installed on your machine, you'll probably see this error:
This means you'll need to go to the developer website instead.
Installing the CLT
When the .dmg
has finished downloaded, double click the file to open it. This will open a little window that looks like this:
Double click the box and follow the prompts to install the CLT. It will take a few minutes to complete.
It may ask you at the end of the installation whether you want to move this to the trash bin. When it does this, it's talking about moving the .dmg
file to the trash bin. Since you should no longer need this file. I always say yes to this.
Step #3: Open Xcode
Open the Applications folder and open the new version of Xcode. If you renamed Xcode, make sure you open the correct application
Xcode may prompt you to install additional components. Click install. This will take a few minutes.
While it's installing, check that your default Xcode version is the one you just downloaded:
- Open Terminal
- Type
brew config
- You should see “CLT” and “Xcode” versions, as well as everything else. This should reflect the version that you have just downloaded. In my case, I downloaded Xcode 11.4.1.
Once the components are installed, Xcode will launch. You should be able to pick up your old projects and continue where you left off seamlessly*.
*Note that if you use any proxy tools, such as Charles, you will need to re-install those certificates in your simulator again.
If you encounter any errors while trying to build or run a project, check which device you are trying to launch. The new version may not remember the device you were using before. If so, click on the device and choose 'Add additional simulators' from the drop down menu to add the device you want.
Step #4. Delete the files
If you don't need the older versions of Xcode on your computer, you can uninstall them and get some hard drive space back.
You can also delete the .xip
file of the version you just downloaded, as well as the CLT.dmg
file.
That's everything. I hope this has helped you successfully install Xcode. Have fun with it!