Skip to content

Instantly share code, notes, and snippets.

@idkjs
Last active March 17, 2021 11:15
Show Gist options
  • Save idkjs/ada82d414eacf5f31fdc4a0857cb7da0 to your computer and use it in GitHub Desktop.
Save idkjs/ada82d414eacf5f31fdc4a0857cb7da0 to your computer and use it in GitHub Desktop.
script to get xcode information on my machine. uses .zsh to get the coloring.
#!/bin/zsh
bold="\e[0;91m"
blue="\e[0;94m"
expand_bg="\e[K"
bold="\e[0;104m${expand_bg}"
bold_bg="\e[0;101m${expand_bg}"
green_bg="\e[0;102m${expand_bg}"
green="\e[0;92m"
white="\e[0;97m"
bold="\e[1m"
uline="\e[4m"
reset="\e[0m"
# https://apple.stackexchange.com/questions/180957/determine-xcode-command-line-tools-version
echo -e "${bold}${green}${uline}## Xcode Versions${reset}" &&
echo -e "${bold}${green}# Xcode from pkgutil --pkgs=com.apple.pkg.Xcode${reset}" &&
echo "-------------------------------------------------------" &&
if pkgutil --pkgs=com.apple.pkg.Xcode >/dev/null; then
echo Xcode: $(pkgutil --pkg-info=com.apple.pkg.Xcode | awk '/version:/ {print $2}')
else
echo Xcode: not installed
fi
echo ""
echo "-------------------------------------------------------" &&
echo -e "${bold}${green}# xcodebuild -version${reset}" &&
echo "-------------------------------------------------------" &&
xcodebuild -version
echo "-------------------------------------------------------" &&
echo ""
echo "-------------------------------------------------------" &&
echo -e "${bold}${green}# CLTools_Executables from pkgutil --pkg-info=com.apple.pkg.CLTools_Executables${reset}" &&
echo "-------------------------------------------------------" &&
pkgutil --pkg-info=com.apple.pkg.CLTools_Executables
if pkgutil --pkg-info=com.apple.pkg.CLTools_Executables >/dev/null; then
echo CLTools_Executables: $(pkgutil --pkg-info=com.apple.pkg.CLTools_Executables | awk '/version:/ {print $2}')
else
echo CLTools_Executables: not installed
fi
echo ""
echo "-------------------------------------------------------" &&
echo -e "${bold}${green}# Command Line Tools for Xcode with pkgutil${reset}" &&
echo "-------------------------------------------------------" &&
if pkgutil --pkgs=com.apple.pkg.CLTools_Executables >/dev/null; then
echo CommandLineTools: $(pkgutil --pkg-info=com.apple.pkg.CLTools_Executables | awk '/version:/ {print $2}')
else
echo CommandLineTools: not installed
fi
echo ""
echo "-------------------------------------------------------" &&
echo -e "${bold}${green}# xcrun --find xcodebuild${reset}" &&
echo "-------------------------------------------------------" &&
xcrun --find xcodebuild
echo "-------------------------------------------------------" &&
echo ""
echo -e "${bold}${green}# which xcodebuild && realpath xcodebuild${reset}" &&
echo "-------------------------------------------------------" &&
which xcodebuild && realpath /usr/bin/xcodebuild
echo "-------------------------------------------------------" &&
echo ""
echo "-------------------------------------------------------" &&
echo -e "${bold}${green}${uline}## GCC${reset}" &&
echo -e "${bold}${green}# gcc -v${reset}" &&
echo "-------------------------------------------------------" &&
gcc -v
echo "-------------------------------------------------------" &&
echo ""
echo -e "${bold}${green}# xcrun --find gcc${reset}" &&
echo "-------------------------------------------------------" &&
xcrun --find gcc
echo "-------------------------------------------------------" &&
echo ""
echo -e "${bold}${green}# llvm-gcc -v${reset}" &&
echo "-------------------------------------------------------" &&
llvm-gcc -v
echo "-------------------------------------------------------" &&
echo ""
echo -e "${bold}${green}${uline}## CLANG${reset}" &&
echo -e "${bold}${green}# clang -v${reset}" &&
echo "-------------------------------------------------------" &&
clang -v
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment