aws / aws/amazon-q-developer-cli
Q CLI update fails with "Directory not empty" error on macOS
- Dominant language
- Rust
- Stars
- 2k
- Forks
- 439
- PR merge metrics
- No merged PRs in 30d
Description
### Checks
- [x] I have searched [github.com/aws/amazon-q-developer-cli/issues](https://github.com/aws/amazon-q-developer-cli/issues?q=) and there are no duplicates of my issue
- [x] I have run `q doctor` in the affected terminal session
- [x] I have run `q restart` and replicated the issue again
### Operating system
macOS 15.5.0 (24F74)
### Expected behaviour
Q CLI should update successfully to the latest version without directory swap errors.
### Actual behaviour
Running `q update` fails with error: "Failed to swap app bundle: Directory not empty (os error 66)". The error persists even after running `q doctor` and clearing cache with `rm -rf ~/.q/cache`.
```
[chat-transcript]
> q update
I'll help you update the Q CLI. Let me run the update command for you.
[Tool uses: execute_bash]
> t
The update failed due to a directory swap issue. Let me run `q doctor` first to diagnose and potentially fix the problem, then try the update again.
[Tool uses: execute_bash]
The doctor found a shell compatibility issue. Let me try the update again anyway, as this might be a separate issue from the update problem.
[Tool uses: execute_bash]
The update is still failing with the same directory swap error. This appears to be a known issue with the Q CLI updater on macOS. Here are a few options to resolve this:
1. **Try force updating** (if available):
\```bash
q update --force
\```
2. **Manually reinstall Q CLI** by downloading the latest version from the official source
3. **Clear Q CLI cache and try again**:
\```bash
rm -rf ~/.q/cache
q update
\```
Let me try the force update option first:
[Tool uses: execute_bash]
The force flag isn't available. Let me check what options are available for the update command:
[Tool uses: execute_bash]
Let me try clearing the Q CLI cache and then updating:
[Tool uses: execute_bash]
[Tool uses: execute_bash]
The update is still failing with the same error. This appears to be a persistent issue with the Q CLI updater on macOS. The error "Directory not empty (os error 66)" suggests the updater can't replace the application bundle because there are files it can't overwrite.
At this point, you have a few options:
1. **Restart your terminal/shell** and try the update again
2. **Completely quit any running Q processes** and try again
3. **Manually reinstall Q CLI** by downloading the latest installer from AWS
4. **Report this issue** using `q issue` so the Q team can investigate
Would you like me to help you with any of these approaches?
[Tool uses: none]
> yes
Let me help you report this issue to the Q team:
[Tool uses: report_issue]
```
### Steps to reproduce
1. Run `q update` 2. Error occurs: "Failed to swap app bundle: Directory not empty (os error 66)" 3. Run `q doctor` (shows shell compatibility issue) 4. Clear cache with `rm -rf ~/.q/cache` 5. Retry `q update -y` - same error persists
### Environment
```yaml
[q-details]
version = "1.19.7"
hash = "cf39ab6297ee7654fcbeed253445d35fe5c92b07"
date = "2025-11-15T19:52:52.480656Z (8d ago)"
[system-info]
os = "macOS 15.5.0 (24F74)"
chip = "Apple M2 Pro"
total-cores = 10
memory = "16.00 GB"
[environment]
cwd = "/Users/dingguiwang_1"
cli-path = "/Users/dingguiwang_1"
install-method = "unknown"
[env-vars]
PATH = "/Users/dingguiwang_1/.antigravity/antigravity/bin:/Users/dingguiwang_1/.nvm/versions/node/v18.20.8/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/Library/Frameworks/Python.framework/Versions/3.12/bin:/Library/Frameworks/Python.framework/Versions/3.11/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Users/dingguiwang_1/.local/bin"
QTERM_SESSION_ID = "3ec9fb5fec9a4aefb4541a9c537c575d"
Q_SET_PARENT_CHECK = "1"
Q_TERM = "1.19.7"
SHELL = "/bin/zsh"
TERM = "xterm-256color"
__CFBundleIdentifier = "com.apple.Terminal"
[chat-settings]
[chat-trusted_tools]
execute_bash=trusted
[chat-failed_request_ids]
none
[chat-context]
current_profile=q_cli_default
profile_context=
AmazonQ.md
AGENTS.md
README.md
.amazonq/rules/**/*.md
files=none
```
Contributor guide
Assessment
This issue has not been assessed yet.