Skip to content

Swiftly deletes itself when installed on Linux with Homebrew#503

Open
marcprux wants to merge 2 commits intoswiftlang:mainfrom
marcprux:patch-1
Open

Swiftly deletes itself when installed on Linux with Homebrew#503
marcprux wants to merge 2 commits intoswiftlang:mainfrom
marcprux:patch-1

Conversation

@marcprux
Copy link

@marcprux marcprux commented Feb 5, 2026

Installing swiftly on Linux with Homebrew puts it at /home/linuxbrew/.linuxbrew/Cellar/swiftly/1.1.1/bin/swiftly, which fails the check for isSystemManaged. Which means that running swiftly init will delete itself.

See the following reproduction:

$ brew install swiftly

==> Installing swiftly
==> Pouring swiftly--1.1.1.x86_64_linux.bottle.tar.gz
🍺  /home/linuxbrew/.linuxbrew/Cellar/swiftly/1.1.1: 10 files, 139.7MB
==> Running `brew cleanup swiftly`...
Disable this behaviour by setting `HOMEBREW_NO_INSTALL_CLEANUP=1`.
Hide these hints with `HOMEBREW_NO_ENV_HINTS=1` (see `man brew`).
==> Caveats
Bash completion has been installed to:
  /home/linuxbrew/.linuxbrew/etc/bash_completion.d

$ which swiftly
/home/linuxbrew/.linuxbrew/bin/swiftly

$ ls -la /home/linuxbrew/.linuxbrew/bin/swiftly
lrwxrwxrwx 1 marcprux marcprux 35 Feb  5 09:17 /home/linuxbrew/.linuxbrew/bin/swiftly -> ../Cellar/swiftly/1.1.1/bin/swiftly

$ tree /home/linuxbrew/.linuxbrew/Cellar/swiftly
/home/linuxbrew/.linuxbrew/Cellar/swiftly
└── 1.1.1
    ├── bin
    │   └── swiftly
    ├── etc
    │   └── bash_completion.d
    │       └── swiftly
    ├── INSTALL_RECEIPT.json
    ├── LICENSE.txt
    ├── NOTICE.txt
    ├── README.md
    ├── sbom.spdx.json
    └── share
        ├── fish
        │   └── vendor_completions.d
        │       └── swiftly.fish
        └── zsh
            └── site-functions
                └── _swiftly

10 directories, 9 files

$ /home/linuxbrew/.linuxbrew/Cellar/swiftly/1.1.1/bin/swiftly init --assume-yes --no-modify-profile --skip-install
Installing swiftly in /home/marcprux/.local/share/swiftly/bin/swiftly...

$ /home/linuxbrew/.linuxbrew/Cellar/swiftly/1.1.1/bin/swiftly init --assume-yes --no-modify-profile --skip-install
-bash: /home/linuxbrew/.linuxbrew/Cellar/swiftly/1.1.1/bin/swiftly: No such file or directory

$ tree /home/linuxbrew/.linuxbrew/Cellar/swiftly
/home/linuxbrew/.linuxbrew/Cellar/swiftly
└── 1.1.1
    ├── bin
    ├── etc
    │   └── bash_completion.d
    │       └── swiftly
    ├── INSTALL_RECEIPT.json
    ├── LICENSE.txt
    ├── NOTICE.txt
    ├── README.md
    ├── sbom.spdx.json
    └── share
        ├── fish
        │   └── vendor_completions.d
        │       └── swiftly.fish
        └── zsh
            └── site-functions
                └── _swiftly

10 directories, 8 files

This PR adds a check for whether the binary is in some path containing ".linuxbrew/Cellar/", which should be general enough to cover most Homebrew Linux configurations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant