xcode-select: error: command line tools are already installed, use “Software Update” to install updates

I am very new to Mac, so I am struggling a lot using basic tools. I was following a documented process to install PHP, and it was asked to run the command :

xcode-select --install

However, I got the error message “xcode-select: error: command line tools are already installed, use “Software Update” to install updates”.

After some research online, thank you StackOverflow, I understood that this message meant that the tool xcode-select was already installed, so I only needed to update it.

The command to use to update Xcode is :

softwareupdate command [args ...]

You can use this command to see what updates are available :

softwareupdate --list

To install all updates, you can run :

softwareupdate --install -a

If you want to update one element, you can get the name from the list command and run :

softwareupdate --install <product name>

More documentation here.

TheTrendyBrand