[FEATURE]: Install script should include instructions to configure the current shell. #9418

Open
opened 2026-02-16 18:12:24 -05:00 by yindo · 1 comment
Owner

Originally created by @aarvinr on GitHub (Feb 15, 2026).

Originally assigned to: @jayair on GitHub.

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

The install script1 should include instructions to restart the shell or source the modified configuration file so the current shell has the updated PATH. Otherwise, running opencode as currently instructed by the install script will error.

Many already know to do this, but others may find this behavior confusing and may (incorrectly) believe that the installation failed. Instructions as described above avoid this situation and are standard for command-line installations.

Originally created by @aarvinr on GitHub (Feb 15, 2026). Originally assigned to: @jayair on GitHub. ### Feature hasn't been suggested before. - [x] I have verified this feature I'm about to request hasn't been suggested before. ### Describe the enhancement you want to request The install script[^1] should include instructions to restart the shell or source the modified configuration file so the current shell has the updated PATH. Otherwise, running `opencode` as currently instructed by the install script will error. Many already know to do this, but others may find this behavior confusing and may (incorrectly) believe that the installation failed. Instructions as described above avoid this situation and are standard for command-line installations. [^1]: https://github.com/anomalyco/opencode/blob/dev/install
yindo added the discussiondocs labels 2026-02-16 18:12:24 -05:00
Author
Owner

@aarvinr commented on GitHub (Feb 15, 2026):

Example implementation:

--- install
+++ install
@@ -5,6 +5,7 @@ MUTED='\033[0;2m'
 RED='\033[0;31m'
 ORANGE='\033[38;5;214m'
 NC='\033[0m' # No Color
+path_modified=""
 
 usage() {
     cat <<EOF
@@ -215,6 +216,7 @@ add_to_path() {
     elif [[ -w $config_file ]]; then
         echo -e "\n# opencode" >> "$config_file"
         echo "$command" >> "$config_file"
+        path_modified="$config_file"
         print_message info "${MUTED}Successfully added ${NC}opencode ${MUTED}to \$PATH in ${NC}$config_file"
     else
         print_message warning "Manually add the directory to $config_file (or similar):"
@@ -289,3 +291,17 @@ echo -e "${MUTED}For more information visit ${NC}https://opencode.ai/docs"
 echo -e ""
 echo -e ""
 
+if [ -n "$path_modified" ]; then
+    case $current_shell in
+        fish)
+            echo -e "${ORANGE}To use opencode now, restart your shell or run:${NC}"
+            echo -e "  source $path_modified"
+            ;;
+        *)
+            echo -e "${ORANGE}To use opencode now, restart your shell or run:${NC}"
+            echo -e "  source $path_modified"
+            ;;
+    esac
+    echo -e ""
+fi

After the final instructions block, if path_modified isn't empty, a message is printed telling the user to either restart their shell or source the specific configuration file that was modified. This keeps the case structure so the message per shell can be customized in the future (e.g., fish uses source the same way, but the wording could be changed if needed).

@aarvinr commented on GitHub (Feb 15, 2026): Example implementation: ```diff --- install +++ install @@ -5,6 +5,7 @@ MUTED='\033[0;2m' RED='\033[0;31m' ORANGE='\033[38;5;214m' NC='\033[0m' # No Color +path_modified="" usage() { cat <<EOF @@ -215,6 +216,7 @@ add_to_path() { elif [[ -w $config_file ]]; then echo -e "\n# opencode" >> "$config_file" echo "$command" >> "$config_file" + path_modified="$config_file" print_message info "${MUTED}Successfully added ${NC}opencode ${MUTED}to \$PATH in ${NC}$config_file" else print_message warning "Manually add the directory to $config_file (or similar):" @@ -289,3 +291,17 @@ echo -e "${MUTED}For more information visit ${NC}https://opencode.ai/docs" echo -e "" echo -e "" +if [ -n "$path_modified" ]; then + case $current_shell in + fish) + echo -e "${ORANGE}To use opencode now, restart your shell or run:${NC}" + echo -e " source $path_modified" + ;; + *) + echo -e "${ORANGE}To use opencode now, restart your shell or run:${NC}" + echo -e " source $path_modified" + ;; + esac + echo -e "" +fi ``` After the final instructions block, if `path_modified` isn't empty, a message is printed telling the user to either restart their shell or `source` the specific configuration file that was modified. This keeps the case structure so the message per shell can be customized in the future (e.g., fish uses `source` the same way, but the wording could be changed if needed).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#9418