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

GCM 2.6 fails to install on macOS Sonoma 14.7 #1717

Open
javier-garcia-sonarsource opened this issue Oct 4, 2024 · 27 comments
Open

GCM 2.6 fails to install on macOS Sonoma 14.7 #1717

javier-garcia-sonarsource opened this issue Oct 4, 2024 · 27 comments
Assignees
Labels
bug A bug in Git Credential Manager installation Specific to installation and uninstallation platform:osx Specific to the macOS platform

Comments

@javier-garcia-sonarsource

GCM 2.6 installation fails using Homebrew command

brew install --cask git-credential-manager

Error message:

==> Downloading https://formulae.brew.sh/api/cask.jws.json
##################################################################################################################################################### 100.0%
==> Downloading https://github.com/git-ecosystem/git-credential-manager/releases/download/v2.6.0/gcm-osx-arm64-2.6.0.pkg
Already downloaded: /Users/<username>/Library/Caches/Homebrew/downloads/4666f1223e9be016ab087da40f8fb50551654ddc553faeb68ca4635dd23021d3--gcm-osx-arm64-2.6.0.pkg
==> Installing Cask git-credential-manager
==> Running installer for git-credential-manager with sudo; the password may be necessary.
Password:
installer: Package name is Git Credential Manager
installer: Installing at base path /
installer: The install failed. (The Installer encountered an error that caused the installation to fail. Contact the software manufacturer for assistance. An error occurred while running scripts from the package “gcm-osx-arm64-2.6.0.pkg”.)
==> Purging files for version 2.6.0 of Cask git-credential-manager
Error: Failure while executing; `/usr/bin/sudo -u root -E LOGNAME=<username> USER= <username> USERNAME= <username> -- /usr/sbin/installer -pkg /opt/homebrew/Caskroom/git-credential-manager/2.6.0/gcm-osx-arm64-2.6.0.pkg -target /` exited with 1. Here's the output:
installer: Package name is Git Credential Manager
installer: Installing at base path /
installer: The install failed. (The Installer encountered an error that caused the installation to fail. Contact the software manufacturer for assistance. An error occurred while running scripts from the package “gcm-osx-arm64-2.6.0.pkg”.)
@mjcheetham
Copy link
Collaborator

Hmm.. I just tried this on macOS 14.7 (build 23H124) with GCM 2.6.0 and got a successful install.

mjcheetham@chronos ~ % brew install --cask git-credential-manager
==> Auto-updating Homebrew...
Adjust how often this is run with HOMEBREW_AUTO_UPDATE_SECS or disable with
HOMEBREW_NO_AUTO_UPDATE. Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
==> Auto-updated Homebrew!
==> Updated Homebrew from 3f11462c14 to 4671af4bb9.
No changes to formulae or casks.

==> Downloading https://github.com/git-ecosystem/git-credential-manager/releases/download/v2.6.0/gcm-osx-arm64-2.6.0.pkg
Already downloaded: /Users/mjcheetham/Library/Caches/Homebrew/downloads/4666f1223e9be016ab087da40f8fb50551654ddc553faeb68ca4635dd23021d3--gcm-osx-arm64-2.6.0.pkg
==> Installing Cask git-credential-manager
==> Running installer for git-credential-manager with sudo; the password may be necessary.
Password:
installer: Package name is Git Credential Manager
installer: Installing at base path /
installer: The install was successful.
🍺  git-credential-manager was successfully installed!

Did you have any previous versions of GCM installed prior to this? What happens if you forcibly uninstall any previous versions, or attempted/incomplete installs and then reinstall?

brew update
brew uninstall --cask --force git-credential-manager
brew install --cask git-credential-manager

@mjcheetham mjcheetham added bug A bug in Git Credential Manager platform:osx Specific to the macOS platform installation Specific to installation and uninstallation labels Oct 4, 2024
@javier-garcia-sonarsource
Copy link
Author

Hi, and thanks for the quick response.
Yes, I'm sure there wasn't any previous version installed. Anyway, I executed your suggested commands and it is still failing:

➜  ~ brew update
brew uninstall --cask --force git-credential-manager
==> Updating Homebrew...
Updated 1 tap (homebrew/core).
==> Outdated Formulae
python@3.12                                                                         xz

You have 2 outdated formulae installed.
You can upgrade them with brew upgrade
or list them with brew outdated.
==> Uninstalling Cask git-credential-manager
==> Running uninstall script /usr/local/share/gcm-core/uninstall.sh
Warning: uninstall script /usr/local/share/gcm-core/uninstall.sh does not exist; skipping.
==> Uninstalling packages with sudo; the password may be necessary:
==> Purging files for version 2.6.0 of Cask git-credential-manager
➜  ~ brew install --cask git-credential-manager
==> Downloading https://github.com/git-ecosystem/git-credential-manager/releases/download/v2.6.0/gcm-osx-arm64-2.6.0.pkg
Already downloaded: /Users/<user>/Library/Caches/Homebrew/downloads/4666f1223e9be016ab087da40f8fb50551654ddc553faeb68ca4635dd23021d3--gcm-osx-arm64-2.6.0.pkg
==> Installing Cask git-credential-manager
==> Running installer for git-credential-manager with sudo; the password may be necessary.
Password:
installer: Package name is Git Credential Manager
installer: Installing at base path /
installer: The install failed. (The Installer encountered an error that caused the installation to fail. Contact the software manufacturer for assistance. An error occurred while running scripts from the package “gcm-osx-arm64-2.6.0.pkg”.)
==> Purging files for version 2.6.0 of Cask git-credential-manager
Error: Failure while executing; `/usr/bin/sudo -u root -E LOGNAME=<user> USER=<user> USERNAME=<user> -- /usr/sbin/installer -pkg /opt/homebrew/Caskroom/git-credential-manager/2.6.0/gcm-osx-arm64-2.6.0.pkg -target /` exited with 1. Here's the output:
installer: Package name is Git Credential Manager
installer: Installing at base path /
installer: The install failed. (The Installer encountered an error that caused the installation to fail. Contact the software manufacturer for assistance. An error occurred while running scripts from the package “gcm-osx-arm64-2.6.0.pkg”.)

@mjcheetham
Copy link
Collaborator

Can you also try running the following commands and reporting back with the output please?

ls /usr/local/share/gcm-core
ls -l /usr/local/bin | grep git-credential-manager

Have you also tried installing via the pkg file rather than via Homebrew? Do you have the same issue (installation failing)?

https://github.com/git-ecosystem/git-credential-manager/releases/download/v2.6.0/gcm-osx-arm64-2.6.0.pkg

@mjcheetham mjcheetham self-assigned this Oct 4, 2024
@javier-garcia-sonarsource
Copy link
Author

Hi @mjcheetham.

➜  ~ sudo ls /usr/local/share/gcm-core
Password:
Atlassian.Bitbucket.dll					System.IO.FileSystem.Watcher.dll			System.Security.Principal.Windows.dll
Avalonia.Base.dll					System.IO.FileSystem.dll				System.Security.Principal.dll
Avalonia.Controls.dll					System.IO.IsolatedStorage.dll				System.Security.SecureString.dll
Avalonia.DesignerSupport.dll				System.IO.MemoryMappedFiles.dll				System.Security.dll
Avalonia.Desktop.dll					System.IO.Pipelines.dll					System.ServiceModel.Web.dll
Avalonia.Dialogs.dll					System.IO.Pipes.AccessControl.dll			System.ServiceProcess.dll
Avalonia.FreeDesktop.dll				System.IO.Pipes.dll					System.Text.Encoding.CodePages.dll
Avalonia.Markup.Xaml.dll				System.IO.UnmanagedMemoryStream.dll			System.Text.Encoding.Extensions.dll
Avalonia.Markup.dll					System.IO.dll						System.Text.Encoding.dll
Avalonia.Metal.dll					System.Linq.Expressions.dll				System.Text.Encodings.Web.dll
Avalonia.MicroCom.dll					System.Linq.Parallel.dll				System.Text.Json.dll
Avalonia.Native.dll					System.Linq.Queryable.dll				System.Text.RegularExpressions.dll
Avalonia.OpenGL.dll					System.Linq.dll						System.Threading.Channels.dll
Avalonia.Remote.Protocol.dll				System.Memory.dll					System.Threading.Overlapped.dll
Avalonia.Skia.dll					System.Net.Http.Json.dll				System.Threading.Tasks.Dataflow.dll
Avalonia.Themes.Fluent.dll				System.Net.Http.dll					System.Threading.Tasks.Extensions.dll
Avalonia.Vulkan.dll					System.Net.HttpListener.dll				System.Threading.Tasks.Parallel.dll
Avalonia.Win32.dll					System.Net.Mail.dll					System.Threading.Tasks.dll
Avalonia.X11.dll					System.Net.NameResolution.dll				System.Threading.Thread.dll
Avalonia.dll						System.Net.NetworkInformation.dll			System.Threading.ThreadPool.dll
GitHub.dll						System.Net.Ping.dll					System.Threading.Timer.dll
GitLab.dll						System.Net.Primitives.dll				System.Threading.dll
HarfBuzzSharp.dll					System.Net.Quic.dll					System.Transactions.Local.dll
MicroCom.Runtime.dll					System.Net.Requests.dll					System.Transactions.dll
Microsoft.AzureRepos.dll				System.Net.Security.dll					System.ValueTuple.dll
Microsoft.CSharp.dll					System.Net.ServicePoint.dll				System.Web.HttpUtility.dll
Microsoft.Identity.Client.Extensions.Msal.dll		System.Net.Sockets.dll					System.Web.dll
Microsoft.Identity.Client.dll				System.Net.WebClient.dll				System.Windows.dll
Microsoft.IdentityModel.Abstractions.dll		System.Net.WebHeaderCollection.dll			System.Xml.Linq.dll
Microsoft.VisualBasic.Core.dll				System.Net.WebProxy.dll					System.Xml.ReaderWriter.dll
Microsoft.VisualBasic.dll				System.Net.WebSockets.Client.dll			System.Xml.Serialization.dll
Microsoft.Win32.Primitives.dll				System.Net.WebSockets.dll				System.Xml.XDocument.dll
Microsoft.Win32.Registry.dll				System.Net.dll						System.Xml.XPath.XDocument.dll
NOTICE							System.Numerics.Vectors.dll				System.Xml.XPath.dll
SkiaSharp.dll						System.Numerics.dll					System.Xml.XmlDocument.dll
System.AppContext.dll					System.ObjectModel.dll					System.Xml.XmlSerializer.dll
System.Buffers.dll					System.Private.CoreLib.dll				System.Xml.dll
System.Collections.Concurrent.dll			System.Private.DataContractSerialization.dll		System.dll
System.Collections.Immutable.dll			System.Private.Uri.dll					Tmds.DBus.Protocol.dll
System.Collections.NonGeneric.dll			System.Private.Xml.Linq.dll				WindowsBase.dll
System.Collections.Specialized.dll			System.Private.Xml.dll					createdump
System.Collections.dll					System.Reflection.DispatchProxy.dll			cs
System.CommandLine.dll					System.Reflection.Emit.ILGeneration.dll			de
System.ComponentModel.Annotations.dll			System.Reflection.Emit.Lightweight.dll			es
System.ComponentModel.DataAnnotations.dll		System.Reflection.Emit.dll				fr
System.ComponentModel.EventBasedAsync.dll		System.Reflection.Extensions.dll			gcmcore.dll
System.ComponentModel.Primitives.dll			System.Reflection.Metadata.dll				git-credential-manager
System.ComponentModel.TypeConverter.dll			System.Reflection.Primitives.dll			git-credential-manager.deps.json
System.ComponentModel.dll				System.Reflection.TypeExtensions.dll			git-credential-manager.dll
System.Configuration.dll				System.Reflection.dll					git-credential-manager.runtimeconfig.json
System.Console.dll					System.Resources.Reader.dll				it
System.Core.dll						System.Resources.ResourceManager.dll			ja
System.Data.Common.dll					System.Resources.Writer.dll				ko
System.Data.DataSetExtensions.dll			System.Runtime.CompilerServices.Unsafe.dll		libAvaloniaNative.dylib
System.Data.dll						System.Runtime.CompilerServices.VisualC.dll		libHarfBuzzSharp.dylib
System.Diagnostics.Contracts.dll			System.Runtime.Extensions.dll				libSkiaSharp.dylib
System.Diagnostics.Debug.dll				System.Runtime.Handles.dll				libSystem.Globalization.Native.dylib
System.Diagnostics.DiagnosticSource.dll			System.Runtime.InteropServices.JavaScript.dll		libSystem.IO.Compression.Native.dylib
System.Diagnostics.FileVersionInfo.dll			System.Runtime.InteropServices.RuntimeInformation.dll	libSystem.Native.dylib
System.Diagnostics.Process.dll				System.Runtime.InteropServices.dll			libSystem.Net.Security.Native.dylib
System.Diagnostics.StackTrace.dll			System.Runtime.Intrinsics.dll				libSystem.Security.Cryptography.Native.Apple.dylib
System.Diagnostics.TextWriterTraceListener.dll		System.Runtime.Loader.dll				libSystem.Security.Cryptography.Native.OpenSsl.dylib
System.Diagnostics.Tools.dll				System.Runtime.Numerics.dll				libclrgc.dylib
System.Diagnostics.TraceSource.dll			System.Runtime.Serialization.Formatters.dll		libclrjit.dylib
System.Diagnostics.Tracing.dll				System.Runtime.Serialization.Json.dll			libcoreclr.dylib
System.Drawing.Primitives.dll				System.Runtime.Serialization.Primitives.dll		libhostfxr.dylib
System.Drawing.dll					System.Runtime.Serialization.Xml.dll			libhostpolicy.dylib
System.Dynamic.Runtime.dll				System.Runtime.Serialization.dll			libmscordaccore.dylib
System.Formats.Asn1.dll					System.Runtime.dll					libmscordbi.dylib
System.Formats.Tar.dll					System.Security.AccessControl.dll			mscorlib.dll
System.Globalization.Calendars.dll			System.Security.Claims.dll				netstandard.dll
System.Globalization.Extensions.dll			System.Security.Cryptography.Algorithms.dll		pl
System.Globalization.dll				System.Security.Cryptography.Cng.dll			pt-BR
System.IO.Compression.Brotli.dll			System.Security.Cryptography.Csp.dll			ru
System.IO.Compression.FileSystem.dll			System.Security.Cryptography.Encoding.dll		tr
System.IO.Compression.ZipFile.dll			System.Security.Cryptography.OpenSsl.dll		uninstall.sh
System.IO.Compression.dll				System.Security.Cryptography.Primitives.dll		zh-Hans
System.IO.FileSystem.AccessControl.dll			System.Security.Cryptography.ProtectedData.dll		zh-Hant
System.IO.FileSystem.DriveInfo.dll			System.Security.Cryptography.X509Certificates.dll
System.IO.FileSystem.Primitives.dll			System.Security.Cryptography.dll
➜  ~ ls -l /usr/local/bin | grep git-credential-manager
lrwxr-xr-x  1 root  wheel  48 Oct  4 13:24 git-credential-manager -> /usr/local/share/gcm-core/git-credential-manager

Have you also tried installing via the pkg file rather than via Homebrew? Do you have the same issue (installation failing)?

Yes, same issue

@xtqqczze
Copy link
Contributor

xtqqczze commented Oct 8, 2024

Hmm.. I just tried this on macOS 14.7 (build 23H124) with GCM 2.6.0 and got a successful install.

Works for me too.

ProductName:		macOS
ProductVersion:		14.7
BuildVersion:		23H124
==> Uninstalling Cask git-credential-manager
==> Running uninstall script /usr/local/share/gcm-core/uninstall.sh
Unconfiguring credential helper...
Deleting symlink...
No legacy symlink found.
Removing installation receipt...
Forgot package 'com.microsoft.gitcredentialmanager' on '/'.
Deleting application files...
==> Uninstalling packages with sudo; the password may be necessary:
==> Purging files for version 2.6.0 of Cask git-credential-manager
==> Downloading https://github.com/git-ecosystem/git-credential-manager/releases/download/v2.6.0/gcm-osx-arm64-2.6.0.pkg
Already downloaded: /Users/xtqqczze/Library/Caches/Homebrew/downloads/4666f1223e9be016ab087da40f8fb50551654ddc553faeb68ca4635dd23021d3--gcm-osx-arm64-2.6.0.pkg
==> Installing Cask git-credential-manager
==> Running installer for git-credential-manager with sudo; the password may be necessary.
installer: Package name is Git Credential Manager
installer: Installing at base path /
installer: The install was successful.
🍺  git-credential-manager was successfully installed!

@mjcheetham
Copy link
Collaborator

@javier-garcia-sonarsource can you try running the following command first before retrying installation?

sudo xcodebuild -license accept

It's possible that you may need to accept the Xcode license agreement to the installation script to complete successfully. The script calls in to Homebrew, which itself calls some of the Xcode CLI tools. We have seen this issue in other versions: #1708

@javier-garcia-sonarsource
Copy link
Author

Sure.
I got this error response:

➜  ~ sudo xcodebuild -license accept

Password:
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

@mjcheetham
Copy link
Collaborator

How about sudo xcrun cc? This should try to run GCC, via Xcode's command line tooling, which should also trigger the prompt (if needed).

@javier-garcia-sonarsource
Copy link
Author

I ran sudo xcrun cc and nothing happened.

➜  ~ sudo xcrun cc
cc: error: no input files

@mjcheetham
Copy link
Collaborator

Hmm.. how strange.. the failure is coming from the postinstall script that is run after install.

The commands/programs that are run are:

  • /usr/bin/which
  • /bin/ln
  • mkdir
  • sudo
  • brew

Could you try running the following and see if any of them fail?

/usr/bin/which brew

/bin/ln

mkdir -p /tmp/test123

sudo uname

brew --version

@javier-garcia-sonarsource
Copy link
Author

Hi, all the commands worked fine:

➜  ~ /usr/bin/which brew
/opt/homebrew/bin/brew
➜  ~ /bin/ln
usage: ln [-s [-F] | -L | -P] [-f | -i] [-hnv] source_file [target_file]
       ln [-s [-F] | -L | -P] [-f | -i] [-hnv] source_file ... target_dir
       link source_file target_file
➜  ~ mkdir -p /tmp/test123
➜  ~ sudo uname
Password:
Darwin
➜  ~ brew --version
Homebrew 4.4.0

@mjcheetham
Copy link
Collaborator

ls -l /bin/bash

?

Short of this, I'll need to update the postinstall script to add extra logging and try and find where the error is occuring.

In the meantime, you can workaround the installation failure by manually extracting the tarball for macOS:

# Download
curl -L -o gcm-osx-arm64-2.6.0.tar.gz https://github.com/git-ecosystem/git-credential-manager/releases/download/v2.6.0/gcm-osx-arm64-2.6.0.tar.gz

# Create directory and extract
sudo mkdir -p /usr/local/share/gcm-core/
sudo tar -xzf gcm-osx-arm64-2.6.0.tar.gz -C /usr/local/share/gcm-core/
sudo chmod +x /usr/local/share/gcm-core/git-credential-manager
sudo chmod +x /usr/local/share/gcm-core/uninstall.sh

# Create symlink
sudo /bin/ln -Fs /usr/local/share/gcm-core/git-credential-manager /usr/local/bin/git-credential-manager

# Configure GCM with Git
/usr/local/bin/git-credential-manager configure

@javier-garcia-sonarsource
Copy link
Author

➜  ~ ls -l /bin/bash
-r-xr-xr-x  1 root  wheel  1310352 Sep  5 11:17 /bin/bash

@javier-garcia-sonarsource
Copy link
Author

I could install it following your commands.
One question, is it supposed to need sudo access to run it?

@mjcheetham
Copy link
Collaborator

is it supposed to need sudo access to run it?

Yes, the root user/sudo is required to install via the pkg or Homebrew (which uses the pkg underneath) in order to install to the /usr/local/share directory, and to create the symlink in /usr/local/bin.

If you want to install GCM without root access, you'll just need to extract the tar.gz file to somewhere you have write access to, chmod to set the execute bits on the git-credential-manager binary, and then run ./git-credential-manager configure.

@xtqqczze
Copy link
Contributor

xtqqczze commented Oct 9, 2024

➜  ~ sudo xcodebuild -license accept

Password:
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

Same output on my machine.

@xtqqczze
Copy link
Contributor

xtqqczze commented Oct 9, 2024

➜  ~ sudo xcrun cc
cc: error: no input files

This is expected output when no file is specified.

@dscho
Copy link
Collaborator

dscho commented Oct 10, 2024

So maybe we could redirect stderr in the post-install script, and upon failure of that command check for some tell-tale of the situation, and in this instance simply ignore the failure?

@zluckytraveler
Copy link

I too am having this exact same issue with both homebrew and package install.

@Genyus
Copy link

Genyus commented Nov 5, 2024

One of my students is also able to reproduce this, running Sonoma 14.5

@Genyus
Copy link

Genyus commented Nov 12, 2024

After much digging, I was able to resolve this on my student's system. Turns out SIP was disabled for some unknown reason; re-enabling fixed this and another seemingly unconnected issue with her JDK installation.

To check its status on your machine, run csrutil status. If the output shows that SIP is disabled, run sudo csrutil clear and reboot, then try installing again.

@dscho
Copy link
Collaborator

dscho commented Nov 12, 2024

Turns out SIP was disabled for some unknown reason; re-enabling fixed this and another seemingly unconnected issue with her JDK installation.

What is SIP, and how did you enable it?

@Chuck1sn
Copy link

image
image

OS 13.7.1 same issue

@dscho
Copy link
Collaborator

dscho commented Nov 13, 2024

Turns out SIP was disabled for some unknown reason; re-enabling fixed this and another seemingly unconnected issue with her JDK installation.

What is SIP, and how did you enable it?

@Genyus ☝️

@xtqqczze
Copy link
Contributor

Turns out SIP was disabled for some unknown reason; re-enabling fixed this and another seemingly unconnected issue with her JDK installation.

What is SIP, and how did you enable it?

System Integrity Protection (SIP) is a macOS security mechanism that enforces kernel-level restrictions on the root user and restricts modification of protected system directories and processes, ensuring only Apple-signed code can alter critical system files.

@Genyus
Copy link

Genyus commented Nov 14, 2024

What is SIP, and how did you enable it?

@dscho I provided the steps to enable it in the comment you replied to. Run csrutil status to check if it's enabled on your system. If it's disabled, run sudo csrutil clear and reboot.

@Genyus
Copy link

Genyus commented Nov 18, 2024

After some testing on my own machine (M1 Max running Sequoia 15.1), the SIP thing might be a red herring. I uninstalled GCM, then disabled SIP and attempted to reinstall. I was able to reproduce the same error message, so at that point, I thought I had confirmed it as a cause — but after re-enabling SIP, the installer continued to fail.

I attempted the manual installation instructions provided by @mjcheetham and received "Permission denied" errors on my ~/.gitconfig file when executing the /usr/local/bin/git-credential-manager configure command.

I checked the permissions and found root had ownership, along with 600 permissions applied. I ran chown and chmod to restore default permissions, then tried again and this time, the installation was successful. I uninstalled GCM and disabled SIP again. Checked the permissions hadn't changed and attempted a reinstall, which ran successfully.

Without better logging, it's probably impossible to know whether everyone encountering this has the same root cause, but .gitconfig permissions may be at least one investigation target.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug in Git Credential Manager installation Specific to installation and uninstallation platform:osx Specific to the macOS platform
Projects
None yet
Development

No branches or pull requests

7 participants