When you try to build xdebug on macOS Catalina you will get errors like these:
Yes, you can run Xcode 12 with the current macOS, Catalina. It will work perfectly, although you can update to the developer beta of Big Sur. Yes, it supports Catalina. I recommend using the latest Big Sur beta, however, so that you can update your app to support the latest technologies. 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.
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:
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
Mac users with macOS Mojave and macOS Catalina, and 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.
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?
- Go to Terminal in /Applications/Utilities/.
- Input the following command string in Terminal:
xcode-select —install
- In the same way when you are downloading new software and apps, a popup update window will appear asking you: “The xcode-select command requires the command line developer tools. Would you like to install the tools now?”
- Select confirm by clicking Install.
- 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!
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:
/Library/Developer/CommandLineTools/
Please note, this is the root /Library of your macOS/OS X, not the ~/Library directory.
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.
Xcode For Mac 10.15.1
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”
Xcode For Mac 10.15.7
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.