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

powershell caveats not reproducible #170589

Closed
3 of 6 tasks
glensc opened this issue Apr 3, 2024 · 2 comments · Fixed by #170730
Closed
3 of 6 tasks

powershell caveats not reproducible #170589

glensc opened this issue Apr 3, 2024 · 2 comments · Fixed by #170730
Labels

Comments

@glensc
Copy link
Contributor

glensc commented Apr 3, 2024

Verification

Description of issue

brew install powershell prints this caveat:

==> Caveats
To use Homebrew in PowerShell, set:
  Add-Content -Path $PROFILE.CurrentUserAllHosts -Value '$(/opt/homebrew/bin/brew shellenv) | Invoke-Expression'

this is not very self-explanatory, obviously, there's no Add-Content command in path, it should be fed to powershell somehow. after brew ls powershell (useless for pkg cask -- doesn't list files) and later cat /Applications/PowerShell.app/Contents/MacOS/PowerShell.sh figured I should feed it to pwsh program

$ pwsh
PowerShell 7.4.1
PS /Users/glen> Add-Content -Path $PROFILE.CurrentUserAllHosts -Value '$(/opt/homebrew/bin/brew shellenv) | Invoke-Expression'
Add-Content: Could not find a part of the path '/Users/glen/.config/powershell/profile.ps1'.
PS /Users/glen>

apparently, the caveat needs to include some install -d ~/.config/powershell first.

perhaps also use pwsh -c to the command so the command wouldn't need to be interactive?

note: I'm not powershell user, just installed it for the first time to run some script.

Command that failed

pwsh

Output of command with --verbose --debug

not relevant - feature request to documentation

Output of brew doctor and brew config

not relevant - feature request to documentation

Output of brew tap

not relevant - feature request to documentation
@razvanazamfirei
Copy link
Member

I believe this should be in homebrew/brew.

@SMillerDev
Copy link
Member

Why? The caveats come from the cask AFAIK

ZhongRuoyu added a commit to ZhongRuoyu/homebrew-cask that referenced this issue Apr 5, 2024
1. Clarify that the commands need to be run in a PowerShell session.
2. Make sure the directory is created before attempting to write to the
   profile.

Fixes Homebrew#170589.
ks3 pushed a commit to ks3/homebrew-cask that referenced this issue Apr 12, 2024
1. Clarify that the commands need to be run in a PowerShell session.
2. Make sure the directory is created before attempting to write to the
   profile.

Fixes Homebrew#170589.
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants