1.首先可以在Xcode中可以通过Xcode > Preferences > Locations路径查看到正在使用的版本和该版本路径,如下图
image.png
2.可以通过xcode-select命令进行查看与修改
通过xcode-select -h命令查看可以使用的命令如下:
-h, --help print this help message and exit
-p, --print-path print the path of the active developer directory
-s <path>, --switch <path> set the path for the active developer directory
--install open a dialog for installation of the command line developer tools
-v, --version print the xcode-select version
-r, --reset reset to the default command line tools path
3.各命令详细介绍
(1)查看xcode-select可使用命令
xcode-select -h
or
xcode-select --help
(2)查看当前正在使用的Xcode版本路径
xcode-select -p
or
xcode-select --print-path
(3)查看xcode-select版本
xcode-select -v
or
xcode-select --version
(4)重置为默认的命令行路径
xcode-select -r
or
xcode-select -reset
(5)修改Xcode使用版本
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
or
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer