git-credential-manager icon indicating copy to clipboard operation
git-credential-manager copied to clipboard

GCM 2.6 fails to install on macOS Sonoma 14.7

Open javier-garcia-sonarsource opened this issue 1 year ago • 37 comments

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”.)

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 avatar Oct 04 '24 10:10 mjcheetham

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
[email protected]                                                                         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”.)

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 avatar Oct 04 '24 13:10 mjcheetham

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

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!

xtqqczze avatar Oct 08 '24 12:10 xtqqczze

@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: https://github.com/git-ecosystem/git-credential-manager/issues/1708

mjcheetham avatar Oct 09 '24 12:10 mjcheetham

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

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).

mjcheetham avatar Oct 09 '24 12:10 mjcheetham

I ran sudo xcrun cc and nothing happened.

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

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

mjcheetham avatar Oct 09 '24 12:10 mjcheetham

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

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

mjcheetham avatar Oct 09 '24 13:10 mjcheetham

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

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

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.

mjcheetham avatar Oct 09 '24 14:10 mjcheetham

➜  ~ 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 avatar Oct 09 '24 17:10 xtqqczze

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

This is expected output when no file is specified.

xtqqczze avatar Oct 09 '24 17:10 xtqqczze

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?

dscho avatar Oct 10 '24 07:10 dscho

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

zluckytraveler avatar Oct 16 '24 09:10 zluckytraveler

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

Genyus avatar Nov 05 '24 20:11 Genyus

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.

Genyus avatar Nov 12 '24 16:11 Genyus

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?

dscho avatar Nov 12 '24 19:11 dscho

image image

OS 13.7.1 same issue

Chuck1sn avatar Nov 13 '24 05:11 Chuck1sn

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 ☝️

dscho avatar Nov 13 '24 06:11 dscho

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.

xtqqczze avatar Nov 13 '24 09:11 xtqqczze

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 avatar Nov 14 '24 18:11 Genyus

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.

Genyus avatar Nov 18 '24 15:11 Genyus

The v2.6.0 postinstall script was also failing for me on an M1 Mac running macOS 14.7.1 (23H222).

After reading @Genyus's comment, I similarly discovered that root had taken ownership of my ~/.gitconfig. Or, more specifically in my case, ~/.gitconfig is a symlink, but the file it points to had become owned by root. Reclaiming ownership of that file allowed me to successfully install the .pkg.

chris-pinola-rf avatar Dec 31 '24 18:12 chris-pinola-rf

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.

@javier-garcia-sonarsource Does this help with your issue?

xtqqczze avatar Jan 01 '25 13:01 xtqqczze

Hope so

On Wed, Jan 1, 2025, 8:14 AM xtqqczze @.***> wrote:

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.

@javier-garcia-sonarsource https://github.com/javier-garcia-sonarsource Does this help with your issue?

— Reply to this email directly, view it on GitHub https://github.com/git-ecosystem/git-credential-manager/issues/1717#issuecomment-2567005185, or unsubscribe https://github.com/notifications/unsubscribe-auth/BEV7X6ZG2MKBIIC3TLH35ML2IPSZZAVCNFSM6AAAAABPLHJFMOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKNRXGAYDKMJYGU . You are receiving this because you are subscribed to this thread.Message ID: @.*** com>

Csnyder9372 avatar Jan 01 '25 13:01 Csnyder9372