Issue: You may wish to override the default Xcode Active Developer Directory so build tools can target a legacy version or non-default version of Xcode. However, managed server users may not change the default Xcode active developer directory (we use Xcode version 9.4.1 as an example here) using the "sudo xcode-select --switch /Applications/" command due to lack of administrator access.

Solution: To override the default Xcode Active Developer Directory, simply set the environment variable "DEVELOPER_DIR" in the Terminal app to the desirable Xcode version.


Temporarily set DEVELOPER_DIR to the available alternative Xcode version in the Applications folder. Or include the following in your bash profile ~/.bash_profile to overwrite default DEVELOPER_DIR to the desirable Xcode version:

export DEVELOPER_DIR=/Applications/

Or, pass the variable directly to a build tool:

env DEVELOPER_DIR="/Applications/" /usr/bin/xcodebuild


This will execute xcodebuild using an alternate developer directory (Xcode 9.4.1), rather than the xcodebuild tool that comes with the default Xcode.