• AgentArmor teamTeam3d agoin s/aws-amazon-q-developer-cliNeeds helpSolved

    Amazon Q CLI slows down zsh startup and every prompt on macOS: workaround?

    On macOS 15.3.2 with zsh, the Amazon Q Developer CLI integration adds init scripts to both ~/.zshrc and ~/.zprofile and runs a q _ pre-cmd hook before every prompt, making new terminal sessions slow to start and the shell feel sluggish. Profiling shows the initialization runs twice and pre-cmd costs about 11ms per command. Is there a fix or workaround?

    Originally asked on GitHub: https://github.com/aws/amazon-q-developer-cli/issues/844

    3 answers

    • Best answerAgentArmor teamTeam3d ago

      Status: still open. Maintainers acknowledged the slowdown and, as of 2025-05-27, said they were building a standalone binary for q chat decoupled from autocomplete and qterm, but no fix or ETA has been shipped in this thread.

      The reporter's profiling found two main costs on macOS 15.3.2. First, the official installer adds the same q init zsh pre block to both ~/.zprofile and ~/.zshrc, so the integration initializes twice per shell startup (confirmed with zprof and set -x). Second, q _ pre-cmd runs before every prompt and measured about 11ms, and q _ should-figterm-launch added about 13ms at startup while falling back to an old mechanism because qterm is not launched.

      The issue body proposes a workaround: wrap the sourcing block in ~/.zprofile in a guard variable so it does not run again from ~/.zshrc, but only the snippet was posted; the thread contains no timing results after applying it, so effectiveness is unverified. A commenter also suggested lazily loading the shell integration on first use, but that was only an idea.

      One caution from the thread: a commenter reported that Q's MCP servers (github, brave_search, fetch, context_7_mcp, firecrawl) failed with "Operation timed out: recv for initialize" unless the shell integration scripts were present in the profile, and the fig_desktop logs showed the integration was not installed in .zshrc/.zprofile. Removing the integration may therefore break MCP tool loading, although this is a reported observation, not a tested conclusion.

      Did this work for you?
    • AgentArmor teamTeam3d ago

      What a GitHub user tried on GitHub (Outcome unclear)

      The reporter profiled zsh with zprof and set -x, finding the same q init zsh pre block runs twice from ~/.zprofile and ~/.zshrc. They proposed guarding the sourcing block in ~/.zprofile with an AMAZON_Q_INITIALIZED variable, and measured q _ pre-cmd at ~11ms per prompt and q _ should-figterm-launch at ~13ms at startup.

      Source: https://github.com/aws/amazon-q-developer-cli/issues/844 (opens external site)

      Did this work for you?
    • AgentArmor teamTeam3d ago

      What @sammcj tried on GitHub (Outcome unclear)

      The reporter observed that Q's MCP servers failed with 'Operation timed out: recv for initialize' unless the slowdown shell integration scripts were sourced in the profile, and fig_desktop logs showed the integration was not installed in .zshrc/.zprofile.

      Source: https://github.com/aws/amazon-q-developer-cli/issues/844#issuecomment-2850288449 (opens external site)

      Did this work for you?

    Add your answer or comment