Install Git On Mac Catalina

After figuring out a way around the massive breaking change introduced by Xcode 11, it's now time to install Xdebug back on MacOS Catalina.

Update from January 6th 2021:
Using MacOS Big Sur? This solution should work for you too. But since Apple Deprecated PHP in MacOS Big Sur, you should probably rely on Homebrew now.

  • Step 2 – Install NVM on macOS. Now, you system is ready for the installation. Update the Homebrew package list and install NVM. Brew update brew install nvm. Next, create a directory for NVM in home. Now, configure the required environment variables. Edit the following configuration file in your home directory.
  • In this tutorial we will learn to install Apache, MySQL, PHP on macOS Catalina 10.15. About macOS Catalina. Apple released macOS Catalina 10.15 on 7th October 2019 and it includes Apache and PHP. So, all we have to do is enable them. Then install MySQL and we are ready for development. So, lets get started.

Update from June 30th 2020:
After some new investigation while trying to upgrade to a newer version of xdebug, I now believe most of the instructions in this post are not necessary. Before doing anything, you should check if xdebug.so already exists in /usr/lib/php/extensions/no-debug-non-zts-20180731/, which I believe is there by default (let me know if otherwise). If it does exist, you could skip to the Enabled support in PHP portion of this post.

Note that building xdebug from source code and actually trying to use that version of xdebug.so (for example by referencing the built file in xdebug/module/xdebug.so after using make install) with the build-in PHP should end up in a 'code signature' error. As described here and here, even after signing the binary, MacOS won't allow system binaries to interact with non-system binaries for security reasons. The only real solution to use a custom version of xdebug would be to compile and use you own instance of PHP instead of the build in one.

Beginner's Setup Guide for Git & Github on Mac OS X. There is an updated version of this post for OS X 10.9. While the steps below should still work, I recommend checking out the new guide if you are running 10.9! There are already plenty of guides that explain the particular steps of getting Git and Github going on your mac in detail. If your Mac is running macOS Big Sur, Catalina, or later, you can access all these hidden fonts and install them for free. It turns out that Apple obtained licenses for a slew of new fonts in macOS that can be used system-wide, but these fonts aren’t installed on the Mac by default.

Long story short, Apple decided to nuke /usr/include in MacOS Catalina, which has been the default location for C header file for ever in UNIX systems. Trying to install through PEAR / PECL will return an error as the compiler will look for necessary headers file in /usr/include. So the solution is to compile Xdebug manually, manually specifying the actual location of the header files, which are still provided by Xcode, just at a different location.

Xcode

The first step is to get Xcode from the App Store.

Once Xcode installed, we have to get the command line tools :

You might need to actually open Xcode at this point to finish installation and accept terms and conditions, especially if the previous command fails.

Finally, make sure the SDK is found. If the path you get differs from the one bellow, you might need to edit the path accordingly later on:

Install Git On Mac Catalina Update

Manually Compiling Xdebug

Getting source

Let's compile 2.7.2, getting the source code from git. Alternatively, you can download the source from Xdebug site.

phpize

Next we need to make a copy phpize so we can edit the include path :

Find this line :

...and replace it with this line :

Catalina

Run phpize:

Install

You should now see something like this :

Configure & build

We can now configure :

...and run make using our custom SDK location defined as compiler flags. I used a variable to store the path to the SDK so it's easier to edit if it changes :

You might see some warning, just ignore it for now. Finally, we'll need to run :

Again, this command will fail because it can't move the extension to the right place. SIP will prevent it. But no worries, we'll take care of that manually at the next step. make install is still required as it will sign the *.so file.

The above trick should work for any PHP extension you want to compile. If you're trying to compile something other than a PHP extension, I recommend having a look at the Makefile to see which directory to include in your custom CPPFLAGS.

Enabled support in PHP

Once make install has been run, we can move the executable somewhere safe. I use /usr/local/php/extensions.

Then we edit the PHP configuration to enable Xdebug. Simply edit php.ini:

And we add the following at the bottom :

Restart built in server to be sure :

And finally test everything went fine :

If the above command returns nothing, then Xdebug is not available on your install. Go back the steps to find out what's missing.

References and thanks :

The NVM (Node Version Manager) is a shell script used for installing and managing Node.js on a Linux based system. The macOS users can install NVM using the homebrew.

This tutorial help you to install NVM on your macOS system and manage Node.js versions.

Prerequisites

You must have macOS desktop access with administrator privileges.

Login to the macOS desktop system and install Homebrew on your system (if not already installed)

For more instruction visit Homebrew installation tutorial.

Step 1 – Remove existing Node Versions

If your system already have node installed, uninstall it first. My system already have installed node via Homebrew. So uninstalling it first. Skip if not already installed.

Step 2 – Install NVM on macOS

Now, you system is ready for the installation. Update the Homebrew package list and install NVM.

Next, create a directory for NVM in home.

Now, configure the required environment variables. Edit the following configuration file in your home directory

and, add below lines to ~/.bash_profile ( or ~/.zshrc for macOS Catalina or later)

How To Install Git On Macos Catalina

Press ESC + :wq to save and close your file.

Next, load the variable to the current shell environment. From the next login, it will automatically loaded.

That’s it. The NVM has been installed on your macOS system. Go to next step to install Node.js versions with the help of nvm.

Step 3 – Install Node.js with NVM

First of all, see what Node versions are available to install. To see available versions, type:

Now, you can install any version listed in above output. You can also use aliases names like node for latest version, lts for latest LTS version, etc.

After installing you can verify what is installed with:

How To Install Git On Mac Catalina

If you have installed multiple versions on your system, you can set any version as the default version any time. To set the node 14.X as default version, simply use:

Similarly, you can install other versions like Node 12.X or Node 15 and switch between them.

Install Git On Catalina

Conclusion

How Do I Install Git On Mac

This tutorial explained you to how to install NVM and node.js on macOS system.