# The issue was because of wrong xcode installation. # I reinstalled xcode and homebrew again and it worked fine. # Don't know why xcode error was not there while using it. xcode-select --install