I have to switch between Xcode versions several times a day for work. I've aliased out the change, but the switch always requires sudo. Is there a way to switch without having to input my password?
I'd like to be able to run the command to switch in the middle of the night (followed by a handful of scripts, etc...), but since the switch requires my password, I can't do it while away.
Any ideas?
cat /Users/zrzka/bin/switch-xcode.sh
:
#!/usr/bin/env bash
EFFECTIVE_UID=$(id -u)
echo "Effective user ID: ${EFFECTIVE_UID}"
echo "Xcode switching to: $@"
&
cat /etc/sudoers.d/switch-xcode
:
zrzka ALL= NOPASSWD: /Users/zrzka/bin/switch-xcode.sh
&
alias switch-xcode="sudo /Users/zrzka/bin/switch-xcode.sh"
&
zrzka@hyrule ~ % switch-xcode foo bar
Effective user ID: 0
Xcode switching to: foo bar
zrzka@hyrule ~ %