@@ -38,6 +38,9 @@ export OSA_SKIP_SNIPPETS=false
3838# Git configuration flag (can be disabled with --disable-git)
3939export OSA_SKIP_GIT_CONFIG=false
4040
41+ # CocoaPods flag (can be disabled with --skip-cocoapods for testing)
42+ export OSA_SKIP_COCOAPODS=false
43+
4144# Setup profile name (tracks which preset was used: minimal, react-native, etc.)
4245export OSA_SETUP_PROFILE=" everything"
4346
@@ -120,19 +123,29 @@ load_json_config() {
120123
121124 # Load components
122125 local -a component_keys=(symlinks oh_my_zsh zsh_plugins homebrew mise osa_snippets git android iterm2 vscode cocoapods)
126+ local -a undefined_components
123127
124128 for key in " ${component_keys[@]} " ; do
125129 local enabled=$( jq -r " .components.${key} // false" " $resolved_path " 2> /dev/null)
130+ local var_name=" OSA_SETUP_$( normalize_key " $key " ) "
131+
126132 if [[ " $enabled " == " true" ]]; then
127- local var_name=" OSA_SETUP_$( normalize_key " $key " ) "
128- # Safe assignment without eval - use typeset/declare
129133 typeset -g " $var_name =true"
130134 else
131- local var_name=" OSA_SETUP_$( normalize_key " $key " ) "
132135 typeset -g " $var_name =false"
136+ # Track undefined components (not explicitly set in config)
137+ local component_exists=$( jq -r " .components | has(\" ${key} \" )" " $resolved_path " 2> /dev/null)
138+ if [[ " $component_exists " != " true" ]]; then
139+ undefined_components+=(" $key " )
140+ fi
133141 fi
134142 done
135143
144+ # Log undefined components that will be skipped (optional, can be removed if too verbose)
145+ if [[ ${# undefined_components[@]} -gt 0 ]] && [[ " $OSA_VERBOSE " == " true" ]]; then
146+ echo -e " ${COLOR_CYAN} Skipping undefined components: ${undefined_components[*]}${COLOR_RESET} "
147+ fi
148+
136149 # Load runtimes
137150 local -a runtime_keys=(node python ruby java rust go deno elixir erlang)
138151
@@ -560,26 +573,18 @@ interactive_setup() {
560573
561574 # macOS pre-flight check: Xcode Command Line Tools
562575 if [[ " $OSA_IS_MACOS " == " true" ]]; then
563- if ! command -v xcode-select & > /dev/null || ! xcode-select -p & > /dev/null; then
576+ # Check if xcode-select returns a valid path (CLT is installed)
577+ # xcode-select -p returns the path to CLT, or fails if not installed
578+ local xcode_path=$( xcode-select -p 2> /dev/null)
579+ if [[ -z " $xcode_path " ]] || [[ ! -d " $xcode_path " ]]; then
564580 echo -e " ${COLOR_YELLOW} ⚠️ Xcode Command Line Tools not found${COLOR_RESET} "
565581 echo " "
566582 echo " Homebrew and many development tools require Xcode CLT."
583+ echo " Install from Apple Developer:"
584+ echo " ${COLOR_BOLD} https://developer.apple.com/download/more/${COLOR_RESET} "
567585 echo " "
568- echo " Two ways to install: "
586+ echo " Or try: ${COLOR_BOLD} xcode-select -- install${COLOR_RESET} "
569587 echo " "
570- echo " Option 1 (Easiest):"
571- echo " ${COLOR_BOLD} xcode-select --install${COLOR_RESET} "
572- echo " "
573- echo " Option 2 (From Apple Developer):"
574- echo " Visit: https://developer.apple.com/download/more/"
575- echo " Search for 'Command Line Tools'"
576- echo " Download and install (Apple login required)"
577- echo " "
578-
579- if ! ask_yes_no " Continue anyway?" " n" ; then
580- echo -e " ${COLOR_RED} Setup cancelled.${COLOR_RESET} "
581- return 1
582- fi
583588 fi
584589 fi
585590
@@ -647,8 +652,12 @@ interactive_setup() {
647652 continue
648653 fi
649654
650- # Special handling for CocoaPods - ask with version selection
655+ # Special handling for CocoaPods - ask with version selection (unless --skip-cocoapods)
651656 if [[ " $key " == " cocoapods" ]]; then
657+ if [[ " $OSA_SKIP_COCOAPODS " == " true" ]]; then
658+ echo -e " ${COLOR_YELLOW} ⊘${COLOR_RESET} Skipping CocoaPods (--skip-cocoapods flag set)"
659+ continue
660+ fi
652661 if is_component_available " $key " ; then
653662 # Source the interactive CocoaPods setup
654663 if source " $OSA_CLI_DIR /src/setup/install-cocoapods-interactive.zsh" ; then
@@ -723,10 +732,27 @@ interactive_setup() {
723732
724733# Automated setup using saved config
725734automated_setup () {
726- echo -e " ${COLOR_BOLD} Running automated setup from saved configuration ...${COLOR_RESET} \n"
735+ echo -e " ${COLOR_BOLD}${COLOR_CYAN} ▶ OSA Setup in progress ...${COLOR_RESET} \n"
727736
728737 print_platform_info
729738
739+ # macOS pre-flight check: Xcode Command Line Tools
740+ if [[ " $OSA_IS_MACOS " == " true" ]]; then
741+ # Check if xcode-select returns a valid path (CLT is installed)
742+ # xcode-select -p returns the path to CLT, or fails if not installed
743+ local xcode_path=$( xcode-select -p 2> /dev/null)
744+ if [[ -z " $xcode_path " ]] || [[ ! -d " $xcode_path " ]]; then
745+ echo -e " ${COLOR_YELLOW} ⚠️ Xcode Command Line Tools not found${COLOR_RESET} "
746+ echo " "
747+ echo " Homebrew and many development tools require Xcode CLT."
748+ echo " Install from Apple Developer:"
749+ echo " ${COLOR_BOLD} https://developer.apple.com/download/more/${COLOR_RESET} "
750+ echo " "
751+ echo " Or try: ${COLOR_BOLD} xcode-select --install${COLOR_RESET} "
752+ echo " "
753+ fi
754+ fi
755+
730756 # Build components in the REQUIRED ORDER (array order matters!)
731757 local -a selected_components
732758
@@ -759,7 +785,7 @@ automated_setup() {
759785 selected_components+=(" git" )
760786 fi
761787
762- if [[ " $OSA_SETUP_COCOAPODS " == " true" ]] && is_component_available " cocoapods" ; then
788+ if [[ " $OSA_SETUP_COCOAPODS " == " true" ]] && [[ " $OSA_SKIP_COCOAPODS " != " true " ]] && is_component_available " cocoapods" ; then
763789 selected_components+=(" cocoapods" )
764790 fi
765791
@@ -802,6 +828,9 @@ automated_setup() {
802828 echo " 1. Try it out: ${COLOR_BOLD} mise --version${COLOR_RESET} "
803829 echo " 2. Test in a new terminal (recommended): ${COLOR_BOLD} zsh${COLOR_RESET} "
804830 echo " 3. Happy coding! 🚀"
831+
832+ echo " "
833+ echo -e " ${COLOR_BOLD}${COLOR_GREEN} ✓ OSA setup completed successfully${COLOR_RESET} "
805834}
806835
807836# Show help
@@ -835,6 +864,7 @@ ${COLOR_BOLD}OPTIONS:${COLOR_RESET}
835864 --local Skip global mise setup (only setup local configs)
836865 --disable-osa-snippets Skip osa-snippets installation (enabled by default)
837866 --disable-git Skip Git configuration (default: configure git)
867+ --skip-cocoapods Skip CocoaPods installation (useful for testing)
838868 --doctor Validate installation and suggest fixes (no changes made)
839869 --report Generate system report for bug reporting
840870 --report-json Generate system report in JSON format
@@ -1003,6 +1033,14 @@ enable_minimal() {
10031033 OSA_SETUP_ZSH_PLUGINS=true
10041034 OSA_SETUP_MISE=true
10051035
1036+ # Disable all optional components
1037+ OSA_SETUP_GIT=false
1038+ OSA_SETUP_ANDROID=false
1039+ OSA_SETUP_COCOAPODS=false
1040+ OSA_SETUP_ITERM2=false
1041+ OSA_SETUP_VSCODE=false
1042+ OSA_SETUP_OSA_SNIPPETS=false
1043+
10061044 # Enable homebrew on macOS
10071045 if [[ " $OSA_IS_MACOS " == " true" ]]; then
10081046 OSA_SETUP_HOMEBREW=true
@@ -1449,7 +1487,6 @@ HOOK_EOF
14491487# Main CLI logic
14501488main () {
14511489 init_components
1452- load_config
14531490
14541491 # Parse arguments
14551492 if [[ $# -eq 0 ]]; then
@@ -1536,6 +1573,10 @@ main() {
15361573 export OSA_SKIP_GIT_CONFIG=true
15371574 shift
15381575 ;;
1576+ --skip-cocoapods)
1577+ export OSA_SKIP_COCOAPODS=true
1578+ shift
1579+ ;;
15391580 # Options that take arguments
15401581 --config|--config-file|--config-json|--config-url|--enable|--disable)
15411582 if [[ -z " $primary_action " ]]; then
@@ -1634,6 +1675,8 @@ main() {
16341675 exit $?
16351676 ;;
16361677 -a|--auto)
1678+ # Load saved config for auto mode
1679+ load_config
16371680 automated_setup
16381681 exit $?
16391682 ;;
0 commit comments