Unable to run Swift Package Manager (macOS 10.14.4)
I fixed my problem by opening "Xcode > Preferences > Locations > Command Line Tools" was not filled so I chose one from list
Coincidentally, I found the solution after trying to install MacPorts, which gave me the error:
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
The solution (from here) was to:
Point xcode-select to the Xcode app Developer directory using the following command: sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
Command 'swift package' then ran as expected.