Open ghost opened 2 years ago
So I figured out the issue: the preview version uses pwsh-preview instead of just pwsh to start powershell. I also managed to install the stable 7.2.2 version by installing the binary archives instead of the .pkg installer. This however doesn't include the launch pad Powershell entry.
What exactly does launching Powershell from launch pad do and why does it require Rosetta? And also, the documentation mentions that dependencies have to be manually installed when installing using the binary archive method. Which dependencies are missing that are included with the .pkg installer?
The launcher app is just a shell script. In its current form it configured to use bash
and use the open
command.
Try opening bash first then use this to see if you get the same behavior.
open pwsh-preview
There is a possibility that the plist file in the launcher may need to be updated to account for the new arm architecture. It’s possible Mac OS is seeing something in there and thinking it a legacy x86 app. I can’t verify any of this as I do not have an arm Mac.
Tried executing open pwsh-preview in bash terminal and got:
The file /Users/<username>/pwsh-preview does not exist.
Where is the shell script and plist file for the launcher located?
Edit: Found both files inside the PowerShell-preview.app/Contents folder. The .sh script runs
open /usr/local/bin/pwsh-preview
Running this from terminal works correctly and starts a PS session. The plist.info file contains the following:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleExecutable</key>
<string>PowerShell.sh</string>
<key>CFBundleGetInfoString</key>
<string>7.3.0-preview.3</string>
<key>CFBundleIconFile</key>
<string>Powershell-preview</string>
<key>CFBundleIdentifier</key>
<string>com.microsoft.powershell-preview</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>PowerShell</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>7.3.0-preview.3</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>MacOSX</string>
</array>
<key>CFBundleVersion</key>
<string>7.3.0-preview.3</string>
</dict>
</plist>
Could something in this file be missing or misconfigured?
I get the same issue when installing latest version (7.2.3 as of writing) via Homebrew. It doesn't complete and requires installation of Rosetta 2. At this point I'm not sure if it's an issue with Homebrew or with PowerShell for M1 Macs.
I got this on an M1 device using powershell-7.2.4-osx-arm64.pkg and just double clicking on it and using the installer GUI.
I think there may be something in the PKGs thats indicating that is contains some x86 requirements.
Did a big of a dig into this an I believe its due to 2 files in the ARM64 package still being compiled as Intel x64 only. My original assumption about the PKG having some kind of flag appears to be false. The macos installer process must scan over binaries within the pkg to detect any that require Rosetta.
Looking at powershell-7.2.4-osx-arm64.pkg with the app "Suspicious Package" I was able to query for executables/libraries based on Apple Silicon support and found that the following files are not ARM64:
/usr/local/microsoft/powershell/7/libmi.dylib /usr/local/microsoft/powershell/7/libpsrpclient.dylib
FYI recently released powershell-7.2.5-osx-arm64.pkg also affected:
Are these files still required?
Still not fixed and causes sight inconvenience for those who do not use rosetta emulated apps at all.
Have created package of 7.2.6 for macOS ARM64 without Rosetta, required change to both installer and the macOS application icon app.
Have created package of 7.2.6 for macOS ARM64 without Rosetta, required change to both installer and the macOS application icon
I see you are repackaging and signing it with your personal certificate. While your fix addresses the issue this type of cert swap is typically frowned upon. You may even get a take down notice. You should do an official pull request for this repo.
The certificate is purely to show that the package has not been tampered with. It is not an assertion of copyright over any of the packaged contents. The original licenses are all in place.
The source of my changes is at https://sourceforge.net/p/rhubarb-pi/code/HEAD/tree/branches/darwin/pkg/powershell/ and you are more than welcome to use whatever fix is appropriate.
I don't have a pull request for your build system and will leave that up to you.
My intention is certainly to remove my package once there is an official package that fixes the problem.
However I can take it down now if that solves the problem.
I see you are repackaging and signing it with your personal certificate. While your fix addresses the issue this type of cert swap is typically frowned upon. You may even get a take down notice. You should do an official pull request for this repo.
Just a clarification, the PowerShell Core project is covered by the MIT license.
https://github.com/PowerShell/PowerShell/blob/master/LICENSE.txt
I have fully complied with this license and more.
GitHubPowerShell for every system! Contribute to PowerShell/PowerShell development by creating an account on GitHub.
Still not fixed in official repo?
how many years would be spent to replace just 2 libraries?!
Hello
Are you open to correct it ? if yes, Can we PR the change ?
Are you open to correct it ? if yes, Can we PR the change ?
I am not in a position to make a PR because I don't understand the project's release procedures and how it creates a deliverable package.
That said, I am maintaining my patch script and still able to create a working package from the contents of the official one by making some small changes.
I have just unpacked the published powershell-7.4.0-osx-arm64.pkg to validate the contents
Use xar
to unpack the package, then cpio
to extract the contents, see my package.sh for the arguments.
As I have described in my README the Applications/PowerShell.app/Contents/MacOS/PowerShell.sh
is a script file with the contents
#!/usr/bin/env bash
open /usr/local/bin/pwsh
I replace this with a compiled ARM64 application still with the same name using the following source
#include <stdlib.h>
#include <unistd.h>
int main(int argc,char **argv)
{
char *args[]={
"/usr/bin/open",
"/usr/local/bin/pwsh",
NULL
};
execv(args[0],args);
return 1;
}
This is all in my git repository.
The important part of testing this fix is using an ARM Mac which has never had Rosetta installed.
Prerequisites
Steps to reproduce
Installed the latest 7.3.0 preview 3 (powershell-7.3.0-preview.3-osx-arm64.pkg) on my M1 Mac and I'm still being prompted to install Rosetta when starting PowerShell-preview from the launch pad, even though the installation says it was successful. Writing pwsh in the console just returns "command not found".
Tried the latest stable 7.2.2 release as well, but it won't even start the installer without Rosetta.
Expected behavior
Actual behavior
Error details
No response
Environment data
Visuals
No response