'xcode-select: error: no developer tools were found, and no install could be requested (perhaps no UI is present)

When I tried to install Xcode command line tools with

xcode-select --install

I got the error

xcode-select: error: no developer tools were found, and no install could be requested (perhaps no UI is present), please install manually from 'developer.apple.com'

I found a similar question here, but this does not work for me. Any ideas? Thanks first.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source