swiftly icon indicating copy to clipboard operation
swiftly copied to clipboard

macOS: Update installation instructions

Open sdavids opened this issue 9 months ago • 1 comments

https://www.swift.org/install/macos/

The installation instructions do not work when one sets up SWIFTLY_HOME_DIR before following them.

$ env -i zsh -df
$ export TERM=xterm-256color
$ export PATH="${HOME}/.local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
$ export XDG_DATA_HOME="${HOME}/.local/share"
$ export SWIFTLY_HOME_DIR="${XDG_DATA_HOME}/swiftly"
$ export SWIFTLY_BIN_DIR="${HOME}/.local/bin"
$ env
HOME=/Users/redacted
LOGNAME=redacted
SHLVL=1
PWD=/Users/redacted/Downloads
OLDPWD=/Users/redacted/Downloads
PATH=/Users/redacted/.local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
XDG_DATA_HOME=/Users/redacted/.local/share
SWIFTLY_HOME_DIR=/Users/redacted/.local/share/swiftly
SWIFTLY_BIN_DIR=/Users/redacted/.local/bin
TERM=xterm-256color
_=/usr/bin/env

$ curl -O https://download.swift.org/swiftly/darwin/swiftly.pkg && \
installer -pkg swiftly.pkg -target CurrentUserHomeDirectory && \
~/.swiftly/bin/swiftly init --quiet-shell-followup && \
. ~/.swiftly/env.sh && \
hash -r
...
Swiftly will be installed into the following locations:

/Users/redacted/.local/share/swiftly - Data and configuration files directory including toolchains
/Users/redacted/.local/bin - Executables installation directory
...
The global default toolchain has been set to `Swift 6.0.3`
Swift 6.0.3 installed successfully!
.: no such file or directory: /Users/redacted/.swiftly/env.sh

I think the installation instructions should be updated to:

curl -O https://download.swift.org/swiftly/darwin/swiftly.pkg && \
installer -pkg swiftly.pkg -target CurrentUserHomeDirectory && \
~/.swiftly/bin/swiftly init --quiet-shell-followup && \
. "${SWIFTLY_HOME_DIR:-~/.swiftly}/env.sh" && \
hash -r

sdavids avatar Mar 30 '25 14:03 sdavids

This change belongs on the swift website repo. You might be interested in this PR, which fixes this problem and adds fish support too: https://github.com/swiftlang/swift-org-website/pull/946

cmcgee1024 avatar Mar 30 '25 19:03 cmcgee1024