sindresorhus / pure

Pretty, minimal and fast ZSH prompt
MIT License
13.12k stars 971 forks source link

Improve getting started for M1 mac users #621

Closed teru01 closed 2 years ago

teru01 commented 2 years ago

resolve https://github.com/sindresorhus/pure/issues/584

reference https://github.com/sindresorhus/pure/issues/584#issuecomment-989054653

mafredri commented 2 years ago

Hmm, this should not be required normally.

My guess is that for this to happen you may have installed Zsh via Homebrew (/opt/homebrew/bin/zsh), but are using the system (/bin/zsh) instead.

We should perhaps add a check during install instead.

BeyondEvil commented 2 years ago

I had to add this line as well. I have not installed zsh using brew, so I'm using the "native" zsh-installation.

mafredri commented 2 years ago

@BeyondEvil the only way it can happen (to my knowledge) is when zsh has been installed via Homebrew.

See https://github.com/sindresorhus/pure/blob/67a80dc72fb2ae9bebb3cffb3d6f789482c2f933/package.json#L19

The relevant part being: if [ -e /opt/homebrew/bin/zsh ]; then PURE_DEST=/opt/homebrew/share/zsh/site-functions npm run --silent postinstall-link && exit 0. So /opt/homebrew/bin/zsh existed, therefore we linked pure into /opt/homebrew/share/zsh/site-functions.

So for a person who has never installed Homebrew and/or zsh through it, adding fpath+=/opt/homebrew/share/zsh/site-functions would not work.

BeyondEvil commented 2 years ago

I don't know what to tell you, dude.

I'm setting up a brand new M1 mac, I have not installed zsh via brew. I did however install pure using brew.

% ls -la /opt/hombrew/bin | grep zsh
%
% which zsh
/bin/zsh
% whence -p zsh
/bin/zsh

Before adding the fpath+=... the prompt did not load. Instead it printed Usage for the prompt command. 🤷‍♂️

I'm happy to provide more information and help troubleshoot if you want.

mafredri commented 2 years ago

@BeyondEvil the Homebrew installation method is not maintained by us, and it looks like it depends on zsh so it would've been pulled in when you installed it via Homebrew.

https://formulae.brew.sh/formula/pure#default

BeyondEvil commented 2 years ago

Ah, interesting @mafredri

Here's the log from brew:

==> Installing dependencies for pure: zsh-async
==> Installing pure dependency: zsh-async
==> Pouring zsh-async--1.8.5.all.bottle.1.tar.gz
🍺  /opt/homebrew/Cellar/zsh-async/1.8.5: 5 files, 30.7KB
==> Installing pure
==> Pouring pure--1.19.0.all.bottle.tar.gz
==> Caveats
zsh functions have been installed to:
  /opt/homebrew/share/zsh/site-functions
==> Summary
🍺  /opt/homebrew/Cellar/pure/1.19.0: 5 files, 45.6KB
==> Running `brew cleanup pure`...

So looks like it didn't pull in zsh, because the default (/bin/zsh) satisfied the installer. But it still installed the site-functions to /opt/homebrew/share/zsh/site-functions.

I took a look at the installer here, and it looks like the test it does for the presence of zsh would be satisfied by the "native" osx zsh.

Would you consider that a bug? If so, I'm happy to report it.

MrCrunchwrap commented 2 years ago

I am using the system zsh on an M1 Mac and I also had to add the line for pure to work

mafredri commented 2 years ago

@likun7981 I hope you don't mind but I marked your comment off-topic since it is an install script for a fork of Pure.

likun7981 commented 2 years ago

@likun7981 I hope you don't mind but I marked your comment off-topic since it is an install script for a fork of Pure.

Ok I’m sorry, I delete it right now