Support Homebrew installation on Apple Silicon machines
Feature description
The default HOMEBREW_PREFIX is /usr/local on non-Apple silicon machines, and our macOS scripts assume that GCM will be installed in the \share sub-directory located in this path. However, it looks like for Apple Silicon it's been updated to /opt/homebrew. We should update our scripts to account for this scenario. For additional context, see #568.
What is the workaround for this in the meantime?
You can install this manually: gcm-osx-arm64-2.0.785.pkg.
Unfortunately manual installation doesn't work for me in this case. Taken from the log - sorry I appreciate the log is not that helpful
An error occurred while running scripts from the package “gcm-osx-arm64-2.0.785 (1).pkg”." UserInfo={NSFilePath=./postinstall, NSURL=file://localhost/Users/whamburger/Downloads/gcm-osx-arm64-2.0.785%20(1).pkg#com.microsoft.gitcredentialmanager.component.pkg, PKInstallPackageIdentifier=com.microsoft.gitcredentialmanager, NSLocalizedDescription=An error occurred while running scripts from the package “gcm-osx-arm64-2.0.785 (1).pkg
Ah yes - I imagine this is related to the changes I'm making here:
https://github.com/GitCredentialManager/git-credential-manager/pull/798/files
However, it's hard to be sure since I unfortunately do not have an M1 Mac 😬.
I'll wait till the release and see how it goes then and re-post here. I also seemed to have posted the wrong log as thats the arm installation 😢 but it was still the same outcome
Completed with:
https://github.com/mjcheetham/update-homebrew/pull/10 https://github.com/GitCredentialManager/git-credential-manager/pull/798 https://github.com/microsoft/homebrew-git/pull/66
So, Homebrew did upgrade it but I did get an error that may be of interest
Update
Actually homebrew didn't update it at all but running brew reinstall --cask git-credential-manager-core did sort it.
Error:
==> Upgrading 1 outdated package:
microsoft/git/git-credential-manager-core 2.0.785 -> 2.0.877
==> Upgrading git-credential-manager-core
==> Downloading https://github.com/GitCredentialManager/git-credential-manager/releases/down
==> Downloading from https://objects.githubusercontent.com/github-production-release-asset-2
######################################################################## 100.0%
==> Running uninstall script /opt/homebrew/share/gcm-core/uninstall.sh
==> Purging files for version 2.0.877 of Cask git-credential-manager-core
Error: microsoft/git/git-credential-manager-core: uninstall script /opt/homebrew/share/gcm-core/uninstall.sh does not exist.
==> Casks with 'auto_updates true' or 'version :latest' will not be upgraded; pass `--greedy
Version:
git-credential-manager-core --version
2.0.785+6074e4e3d3
System:
neofetch --off
[email protected]
----------------------------
OS: macOS 13.0.1 22A400 arm64
Host: Macmini9,1
Kernel: 22.1.0
Uptime: 23 mins
Packages: 339 (brew)
Shell: zsh 5.8.1
Resolution: 2560x1440, 2560x1440
DE: Aqua
WM: Quartz Compositor
WM Theme: Blue (Light)
Terminal: iTerm2
Terminal Font: CaskaydiaCoveNerdFontComplete-Regular 16
CPU: Apple M1
GPU: Apple M1
Memory: 2238MiB / 16384MiB
So, Homebrew did upgrade it but I did get an error that may be of interest
Error:
==> Upgrading 1 outdated package: microsoft/git/git-credential-manager-core 2.0.785 -> 2.0.877 ==> Upgrading git-credential-manager-core ==> Downloading https://github.com/GitCredentialManager/git-credential-manager/releases/down ==> Downloading from https://objects.githubusercontent.com/github-production-release-asset-2 ######################################################################## 100.0% ==> Running uninstall script /opt/homebrew/share/gcm-core/uninstall.sh ==> Purging files for version 2.0.877 of Cask git-credential-manager-core Error: microsoft/git/git-credential-manager-core: uninstall script /opt/homebrew/share/gcm-core/uninstall.sh does not exist. ==> Casks with 'auto_updates true' or 'version :latest' will not be upgraded; pass `--greedyVersion:
git-credential-manager-core --version 2.0.785+6074e4e3d3System:
neofetch --off [email protected] ---------------------------- OS: macOS 13.0.1 22A400 arm64 Host: Macmini9,1 Kernel: 22.1.0 Uptime: 23 mins Packages: 339 (brew) Shell: zsh 5.8.1 Resolution: 2560x1440, 2560x1440 DE: Aqua WM: Quartz Compositor WM Theme: Blue (Light) Terminal: iTerm2 Terminal Font: CaskaydiaCoveNerdFontComplete-Regular 16 CPU: Apple M1 GPU: Apple M1 Memory: 2238MiB / 16384MiB
Same issue for me on my M1 MacBook. Upgrading via the brew upgrade git-credential-manager-core command requires the package to be uninstalled first, but results in the uninstall.sh does not exist error.
To temporarily satisfy the error, I manually created the gcm-core folder under /opt/homebrew/share and placed uninstall.sh file in it. (I assume the paths to symlinks to be different for arm packages) ...and success!
However, even after the upgrade, the issue persists while uninstalling (I assume so as well for future upgrading).
Version:
$ git-credential-manager-core --version
warning: git-credential-manager-core was renamed to git-credential-manager
warning: see https://aka.ms/gcm/rename for more information
2.0.877+c7c35983b8
Error:
$ brew uninstall --cask git-credential-manager-core
==> Uninstalling Cask git-credential-manager-core
==> Running uninstall script /opt/homebrew/share/gcm-core/uninstall.sh
Error: uninstall script /opt/homebrew/share/gcm-core/uninstall.sh does not exist.
Thanks.
https://github.com/GitCredentialManager/git-credential-manager/pull/966 should resolve. Sorry for the pain here!
I got around this by:
ln -s /usr/local/share/gcm-core /opt/homebrew/share/gcm-core
brew uninstall --cask git-credential-manager-core
brew install git-credential-manager-core
Thanks @codyzu ! I'm guessing one should also rm /opt/homebrew/share/gcm-core to cleanup the hack.
What helped me was running those commands.
xcode-select --install brew install gcc