-
-
Notifications
You must be signed in to change notification settings - Fork 8.8k
Please fix the setup script for macOS #3558
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Not all Mac OS users use zsh, so it definitely shouldn’t do it by platform. |
@ljharb said:
I think last 2-3 years macOS ships with zsh. So you always can check if zsh is available and use one output, with a fallback to bash. Seems an easy check |
Yes, that's true, but if you've continuously migrated your Mac environment from prior to that, then you'll stay on bash, as I have. zsh is always available now, that can't be used to make a choice. I have a |
https://support.apple.com/en-us/102360
https://en.wikipedia.org/wiki/MacOS_Catalina
|
Not everybody is as old as we are 😉 |
You always can see in which shell you run the installation script (bash, zsh, etc), right? Depending on it you can write to terminal the correct instructions. I think you can see how other projects achieve this. Or if no luck with detection, write few possible lines - each for each supported shell. |
Unfortunately, the output of
But I think a 90% solution is better then doing nothing: If |
I'd be happy to review a PR that did that - noting that the install script must always run in bash. |
I experimented a little: $ sw_vers
ProductName: macOS
ProductVersion: 12.7.6
BuildVersion: 21H1320
$ ps -p $$
PID TTY TIME CMD
77576 ttys002 0:00.20 -zsh
$ echo $SHELL
/bin/zsh
$ echo $ZSH_NAME
zsh
$ mkdir /tmp/test && cd "$_"
$ printf '#!/usr/bin/env bash\necho $(ps -p $$)\necho $SHELL\necho $BASH\necho $ZSH_NAME\n' >install.sh
$ chmod u+x install.sh
$ curl -so- file:///tmp/test/install.sh | zsh
PID TTY TIME CMD 78615 ttys001 0:00.01 zsh
/bin/zsh
zsh
$ curl -so- file:///tmp/test/install.sh | bash
PID TTY TIME CMD 78651 ttys001 0:00.01 bash
/bin/zsh
/usr/local/bin/bash
$ zsh -c 'curl -so- curl -so- file:///tmp/test/install.sh | zsh'
PID TTY TIME CMD 78691 ttys001 0:00.01 zsh
/bin/zsh
zsh
$ zsh -c 'curl -so- curl -so- file:///tmp/test/install.sh | bash'
PID TTY TIME CMD 78702 ttys001 0:00.01 bash
/bin/zsh
/usr/local/bin/bash
$ bash -c 'curl -so- curl -so- file:///tmp/test/install.sh | zsh'
PID TTY TIME CMD 78767 ttys001 0:00.01 zsh
/bin/zsh
zsh
$ bash -c 'curl -so- curl -so- file:///tmp/test/install.sh | bash'
PID TTY TIME CMD 78755 ttys001 0:00.01 bash
/bin/zsh
/usr/local/bin/bash
$ docker run -it --rm -v /tmp/test:/tmp/test ubuntu:noble-20250404 bash
# apt-get -y update && apt-get -y install curl
# curl -so- file:///tmp/test/install.sh | bash
PID TTY TIME CMD 2927 pts/0 00:00:00 bash
/bin/bash
/usr/bin/bash
# exit
$ docker run -it --rm -v /tmp/test:/tmp/test ubuntu:noble-20250404 bash
# apt-get -y update && apt-get -y install curl zsh
# zsh
# ps -p $$
PID TTY TIME CMD
3025 pts/0 00:00:00 zsh
# curl -so- file:///tmp/test/install.sh | bash
PID TTY TIME CMD 3047 pts/0 00:00:00 bash
/bin/bash
/usr/bin/bash
# curl -so- file:///tmp/test/install.sh | zsh
PID TTY TIME CMD 3050 pts/0 00:00:00 zsh
zsh
# exit
# zsh -c 'curl -so- curl -so- file:///tmp/test/install.sh | bash'
PID TTY TIME CMD 3056 pts/0 00:00:00 bash
/bin/bash
/usr/bin/bash
# zsh -c 'curl -so- curl -so- file:///tmp/test/install.sh | zsh'
PID TTY TIME CMD 3061 pts/0 00:00:00 zsh
zsh As expected, a mess 🫣 |
There are three options:
2. and 3. could either install zsh completions immediately or ask something along the lines "It seems that you are you using zsh; do you want to install zsh completions instead of bash completions?" |
On macOS there setup script mentioned bash completions, but it should be zsh completions instead. An easy fix, but it will save hours for many macOS users. Please fix it.
Originally posted by @amlzq in #2361
The text was updated successfully, but these errors were encountered: