Skip to content

Conversation

@plemarquand
Copy link
Contributor

When swiftly is installed via homebrew it is placed in /opt/homebrew/bin/swiftly, which is a symlink to a location like /opt/homebrew/bin/Cellar/swiftly/1.1.0/bin/swiftly.

When checking if Swiftly is linked we check to see if the swiftly symlink in the swiftly bin directory is pointing to the swiftly executable. However with Homebrew, the symlink is not pointing to the swiftly executable but instead to another symlink that in turn points to the executable.

Augment fs.readlink to accept a follow paramter, which will follow symlinks until we reach the real underlying file.

By following the trail of symlinks from the swiftly bin directory to the underlying swiftly executable the isLinked check will succeed and no longer report that swiftly is unlinked when its actually linked correctly.

When swiftly is installed via homebrew it is placed in
`/opt/homebrew/bin/swiftly`, which is a symlink to a location like
`/opt/homebrew/bin/Cellar/swiftly/1.1.0/bin/swiftly`.

When checking if Swiftly is linked we check to see if the `swiftly`
symlink in the swiftly bin directory is pointing to the swiftly
executable. However with Homebrew, the symlink is not pointing to the
swiftly executable but instead to _another symlink_ that in turn points
to the executable.

Augment `fs.readlink` to accept a `follow` paramter, which will follow
symlinks until we reach the real underlying file.

By following the trail of symlinks from the swiftly bin directory to the
underlying swiftly executable the isLinked check will succeed and no
longer report that swiftly is unlinked when its actually linked
correctly.
@plemarquand
Copy link
Contributor Author

The underlying issue was discovered by users using Swiftly via Homebrew with the Swift VS Code extension. The extension would do swiftly use --print-location, which would print the active toolchain location correctly but not before printing the "swiftly is unlinked" warning message. This tripped up the extension which expected only a path, and caused it to stall and ultimately fail to activate on startup. See swiftlang/vscode-swift#1975 for more info

@plemarquand
Copy link
Contributor Author

Closed in favour of #460

@plemarquand plemarquand closed this Dec 3, 2025
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