Skip to content
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

Issue after upgrading prompt #86

Open
Frostymnl opened this issue Jan 14, 2021 · 14 comments
Open

Issue after upgrading prompt #86

Frostymnl opened this issue Jan 14, 2021 · 14 comments
Assignees

Comments

@Frostymnl
Copy link

Frostymnl commented Jan 14, 2021

After updating my prompt I get the folowing output when my terminal starts ->

Last login: Thu Jan 14 12:47:40 on console

prompt: using bash shell
prompt: a new version of prompt is available: a95f87e6bdba2404804fb3ba30396805c1b41102
 - run the update-prompt command line tool to upgrade
-bash: /Users/<USERNAME>/.am/prompt/bash/completions/*: No such file or directory
-bash: __posh_git_ps1: command not found

The -bash: __posh_git_ps1: command not found appears after running any command in prompt.
I also receive a prompt: cannot retrieve SHA of latest version. Are you connected to the internet? quite a bit even though I am connected to the internet.

macOS Catalina Version 10.15.7

@patrickserrano
Copy link
Contributor

@dmccaffery this is the install output that Ross had shared with me.

It looks to me like the platform install script wasn't called which would set the completions, git prompt, etc based on the lack of prompt arrow after attempting to install.

Also I suggested trying the next release, but he couldn't get it to work because of the ...cannot retrieve SHA error. Could this have to do with hitting the GitHub API too frequently?

prompt: using bash shell
prompt: a new version of prompt is available: a95f87e6bdba2404804fb3ba30396805c1b41102
  - run the update-prompt command line tool to upgrade
-bash: /Users/ross/.am/prompt/bash/completions/*: No such file or directory
-bash: __posh_git_ps1: command not found
am-mbp-142:~ ross$ update-prompt

prompt: establishing sudo (you may be prompted for credentials)...
Password:

prompt-install: creating backup path: /Users/ross/.am/backup/prompt/20210114_113908
prompt-install: backing up bash_profile
prompt-install: backing up bashrc
prompt-install: backing up profile
prompt-install: backing up zprofile
prompt-install: backing up zshrc
prompt-install: backing up /Users/ross/.am/prompt
prompt-install: removing /Users/ross/.am/prompt
prompt-install: creating /Users/ross/.am/prompt
prompt-install: installing promptMastermind to /Users/ross/.am/prompt
prompt-install: installing platform prerequisites (darwin.sh)

##############################################################################
INSTALLING VIA HOMEBREW FOR INTEL MACS
##############################################################################

installing homebrew...
==> This script will install:
/usr/local/bin/brew
/usr/local/share/doc/homebrew
/usr/local/share/man/man1/brew.1
/usr/local/share/zsh/site-functions/_brew
/usr/local/etc/bash_completion.d/brew
/usr/local/Homebrew
==> /usr/bin/sudo /usr/sbin/chown ross:admin /usr/local/Homebrew
==> Downloading and installing Homebrew...
HEAD is now at e989a0fb0 Merge pull request #10327 from MikeMcQuaid/keg-fix-alias-handling
Updated 2 taps (homebrew/core and homebrew/services).
==> Installation successful!

==> Homebrew has enabled anonymous aggregate formulae and cask analytics.
Read the analytics documentation (and how to opt-out) here:
  https://docs.brew.sh/Analytics
No analytics data has been sent yet (or will be during this `install` run).

==> Homebrew is run entirely by unpaid volunteers. Please consider donating:
  https://github.com/Homebrew/brew#donations

==> Next steps:
- Run `brew help` to get started
- Further documentation: 
    https://docs.brew.sh
HOMEBREW_VERSION: 2.7.4-17-ge989a0f
ORIGIN: https://github.com/Homebrew/brew
HEAD: e989a0fb011e0f2f8b61cd195c4703c71a4b4b7f
Last commit: 3 hours ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 20f54d5c5f560836d4a39dbafb21a0a1f30ab44e
Core tap last commit: 15 seconds ago
Core tap branch: master
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CASK_OPTS: []
HOMEBREW_DISPLAY: /private/tmp/com.apple.launchd.u7evAZXDp9/org.macosforge.xquartz:0
HOMEBREW_EDITOR: code --wait
HOMEBREW_MAKE_JOBS: 8
Homebrew Ruby: 2.6.3 => /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.3_2/bin/ruby
CPU: octa-core 64-bit kabylake
Clang: 11.0 build 1100
Git: 2.30.0 => /usr/local/bin/git
Curl: 7.64.1 => /usr/bin/curl
Java: 1.8.0_172
macOS: 10.15.7-x86_64
CLT: 11.0.33.12
Xcode: 12.3
XQuartz: 2.7.11 => /opt/X11
updating homebrew...
Already up-to-date.
upgrading: openssl...
upgrading: git...
To relink:
  brew unlink git && brew link git
upgrading: go...
To relink:
  brew unlink go && brew link go
upgrading: nvm...
To relink:
  brew unlink nvm && brew link nvm
upgrading: python...
To relink:
  brew unlink [email protected] && brew link [email protected]
upgrading: gpg...
To relink:
  brew unlink gnupg && brew link gnupg
upgrading: pinentry-mac...
To relink:
  brew unlink pinentry-mac && brew link pinentry-mac
setting up nvm...
Installing latest LTS version.
Now using node v14.15.4 (npm v6.14.10)
setting git credential helper to use the macOS keychain
prompt-install: downloading better git-prompt
upgrading: bash...
To relink:
  brew unlink bash && brew link bash
upgrading: bash-completion...
To relink:
  brew unlink bash-completion && brew link bash-completion

##############################################################################
##############################################################################
     # $SHELL will be /usr/local/bin/bash
     PLEASE RUN: exec -l $SHELL
##############################################################################
##############################################################################

open-url: opening https://github.com/automotivemastermind/prompt/blob/v8.2.0/CHANGELOG.md via open...
-bash: __posh_git_ps1: command not found
am-mbp-142:~ ross$ exec -l $SHELL

prompt: using bash shell
prompt: a new version of prompt is available: a95f87e6bdba2404804fb3ba30396805c1b41102
  - run the update-prompt command line tool to upgrade
bash: /Users/ross/.am/prompt/bash/completions/*: No such file or directory
bash: __posh_git_ps1: command not found
am-mbp-142:~ ross$ 

@dmccaffery
Copy link
Member

Please restore the latest backup from:

~/.am/backup/prompt

This is the fastest way to unblock. There seems to be issues with hitting the GitHub API too often without being authenticated. Homebrew hits GitHub quite a bit as well, but prompt (even install) should not be hitting the api that hard. I suspect something else on your system is hitting the GitHub API and you're bumping up against the anonymous limits.

Couple of things to try after restoring the backup:

  1. Run the github-token command to set a GitHub PAT that both prompt and homebrew will use when hitting the GitHub API.

  2. Run edit-vars and set the prompt update var to 0; this will stop prompt from checking for new versions when launching a shell.

  3. Launch a new terminal window to ensure the above is respected; then run:

GITHUB_TOKEN=${GITHUB_TOKEN} update-prompt

Let me know how you make out. Happy to jump on a call if the issue persists.

@dmccaffery
Copy link
Member

I should note, based on the output you shared, the installer worked as expected. It called the platform install (darwin) and also installed "better git prompt" which is where the function for posh_git_ps1 comes from -- more likely, there is an issue where the better git prompt script isn't being evaluated. I'll see if I can reproduce.

@Frostymnl
Copy link
Author

Hey @dmccaffery,
I am not sure how to restore from a backup do I just copy the files from ~/.am/backup/prompt/date to ~/.am/prompt, I am not sure where the individual files go from ~/.am/backup/prompt/date they do not seem to have counterparts in ~/.am/prompt

@Frostymnl
Copy link
Author

Alright so this is what I did ->

  1. moved only the folders from ~/.am/backup/prompt/date to ~/.am/prompt after deleting all files in ~/.am/prompt
  2. I am not sure what run github-token meant but google lead me to create an enviroment variable for HOMEBREW_GITHUB_API_TOKEN https://stackoverflow.com/questions/20130681/setting-github-api-token-for-homebrew
  3. ran edit-vars and set update value to 0
  4. Launched a new terminal window
  5. ran GITHUB_TOKEN=${GITHUB_TOKEN} update-prompt
  6. ran exec -l $SHELL

this still had the issue

Last login: Thu Jan 14 14:41:24 on ttys000

prompt: using bash shell

ross@am-mbp-142 : ~
  ==> GITHUB_TOKEN=${GITHUB_TOKEN} update-prompt
removing path: /Users/ross/.am/backup/prompt...

prompt: establishing sudo (you may be prompted for credentials)...
Password:

prompt-install: creating backup path: /Users/ross/.am/backup/prompt/20210114_145031
prompt-install: backing up bash_profile
prompt-install: backing up bashrc
prompt-install: backing up profile
prompt-install: backing up zprofile
prompt-install: backing up zshrc
prompt-install: backing up /Users/ross/.am/prompt
prompt-install: removing /Users/ross/.am/prompt
prompt-install: creating /Users/ross/.am/prompt
prompt-install: installing promptMastermind to /Users/ross/.am/prompt
prompt-install: installing platform prerequisites (darwin.sh)

##############################################################################
INSTALLING VIA HOMEBREW FOR INTEL MACS
##############################################################################

installing homebrew...
==> This script will install:
/usr/local/bin/brew
/usr/local/share/doc/homebrew
/usr/local/share/man/man1/brew.1
/usr/local/share/zsh/site-functions/_brew
/usr/local/etc/bash_completion.d/brew
/usr/local/Homebrew
==> /usr/bin/sudo /usr/sbin/chown ross:admin /usr/local/Homebrew
==> Downloading and installing Homebrew...
HEAD is now at edfa34064 Merge pull request #10137 from sjackman/sj/governance
Updated 2 taps (homebrew/core and homebrew/cask).
==> Updated Formulae
carthage                                                                                                                 nomad                                                                                                                    spades
==> New Casks
aldente                                                                                                                                                                               deadbeef
==> Updated Casks
abricotine                                                  ajour                                                       docker                                                      kotlin-native                                               portfolioperformance                                        routebuddy
==> Installation successful!

==> Homebrew has enabled anonymous aggregate formulae and cask analytics.
Read the analytics documentation (and how to opt-out) here:
  https://docs.brew.sh/Analytics
No analytics data has been sent yet (or will be during this `install` run).

==> Homebrew is run entirely by unpaid volunteers. Please consider donating:
  https://github.com/Homebrew/brew#donations

==> Next steps:
- Run `brew help` to get started
- Further documentation: 
    https://docs.brew.sh
HOMEBREW_VERSION: 2.7.4-21-gedfa340
ORIGIN: https://github.com/Homebrew/brew
HEAD: edfa340646c85f0f6de4aa19c63517e1ec94b8c4
Last commit: 3 hours ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: e5b6b827579cac83b617ade406d7d2b8b538a38d
Core tap last commit: 13 minutes ago
Core tap branch: master
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CASK_OPTS: []
HOMEBREW_DISPLAY: /private/tmp/com.apple.launchd.HEjahIoZwf/org.macosforge.xquartz:0
HOMEBREW_EDITOR: code --wait
HOMEBREW_GITHUB_API_TOKEN: set
HOMEBREW_MAKE_JOBS: 8
Homebrew Ruby: 2.6.3 => /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.3_2/bin/ruby
CPU: octa-core 64-bit kabylake
Clang: 11.0 build 1100
Git: 2.30.0 => /usr/local/bin/git
Curl: 7.64.1 => /usr/bin/curl
Java: 1.8.0_172
macOS: 10.15.7-x86_64
CLT: 11.0.33.12
Xcode: 12.3
XQuartz: 2.7.11 => /opt/X11
updating homebrew...
Already up-to-date.
upgrading: openssl...
upgrading: git...
To relink:
  brew unlink git && brew link git
upgrading: go...
To relink:
  brew unlink go && brew link go
upgrading: nvm...
To relink:
  brew unlink nvm && brew link nvm
upgrading: python...
To relink:
  brew unlink [email protected] && brew link [email protected]
upgrading: gpg...
To relink:
  brew unlink gnupg && brew link gnupg
upgrading: pinentry-mac...
To relink:
  brew unlink pinentry-mac && brew link pinentry-mac
setting up nvm...
Installing latest LTS version.
Now using node v14.15.4 (npm v6.14.10)
setting git credential helper to use the macOS keychain
prompt-install: downloading better git-prompt
upgrading: bash...
To relink:
  brew unlink bash && brew link bash
upgrading: bash-completion...
To relink:
  brew unlink bash-completion && brew link bash-completion

##############################################################################
##############################################################################
     # $SHELL will be /usr/local/bin/bash
     PLEASE RUN: exec -l $SHELL
##############################################################################
##############################################################################

open-url: opening https://github.com/automotivemastermind/prompt/blob/v8.2.0/CHANGELOG.md via open...

ross@am-mbp-142 : ~
  ==> exec -l $SHELL

prompt: using bash shell
bash: /Users/ross/.am/prompt/bash/completions/*: No such file or directory
bash: __posh_git_ps1: command not found
am-mbp-142:~ ross$ 

but doing step 1 seemed to make it so prompt worked so I will do step 1 again until y'all have more steps for me to try :)

@jeffreypmoran
Copy link

FWIW, I ran into all the same behaviors as Ross minus the github SHA issue.

@dmccaffery
Copy link
Member

github-token is a prompt command that makes the token available to prompt, homebrew, terraform, etc.

I'll take a look. This must be a bash specific issue; I've been running zsh for well over a year now (it's the default on macOS these days).

Will follow up with any findings. Apologies for the issues!

@sjk07
Copy link
Member

sjk07 commented Feb 9, 2021

@jeffreypmoran @Frostymnl @patrickserrano Is this still a problem?

@jeffreypmoran
Copy link

@sjk07 @patrickserrano FWIW, I ran into this issue again today when setting up a fresh machine.

@dmccaffery
Copy link
Member

@jeffreypmoran -- I will work on this tonight

@patrickserrano
Copy link
Contributor

@jeffreypmoran when you were setting up a fresh machine did you specify zsh when installing prompt? E.g. curl -fsSL https://git.io/am-prompt | sh -s -- zsh

@dmccaffery can you clarify if running curl -fsSL https://git.io/am-prompt | sh -s -- bash from zsh should work and change the default shell to bash? I've seen a lot of users setting up new machines with that command who end up with a broken install. Usually running use-shell zsh fixes the issue, but it's not 100% clear to me if the issue is that the wrong install command was used (so we need clearer docs) or if there's an issue in the expected behavior.

@jeffreypmoran
Copy link

@patrickserrano I specified bash when installing

@jeffreypmoran
Copy link

@dmccaffery have you had a chance to look into this issue yet?

@dmccaffery
Copy link
Member

@jeffreypmoran

I know what the issue is; just have not had a chance to fix. I'll work on it this weekend.

@patrickserrano

You should be able to switch between zsh and bash, or configure either or regardless of the terminal shell being used (including dash, ash, ksh, fish, etc). We have tests to validate this; but they were broken in that previous [wip] that got merged.

The new shell should be dramatically faster as it no longer relies on shell interpreters for the prompt itself; this was [wip] as there were things I was working out to fully support arm64 (Apple M1 as well as Linux on arm). Some PRs of mine that were pending in the upstream starship project (that I finally got through) were required as well.

I'll get it fully ironed out over the weekend.

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

No branches or pull requests

5 participants