I’m trying to install php on my Mac running Monterey. I try to install it using brew and I get this error: Error: Git must be installed and in your PATH!
I’ve tried brew doctor and brew upgrade and they give the same error. Any help would be great.
Here’s the full code below:
andrews-mbp:OSX-Messages-Exporter-master andrew$ brew install [email protected]
/usr/local/Homebrew/Library/Homebrew/version.rb:366:in `initialize': Version value must be a string; got a NilClass () (TypeError)
from /usr/local/Homebrew/Library/Homebrew/os/mac/version.rb:23:in `initialize'
from /usr/local/Homebrew/Library/Homebrew/os/mac.rb:18:in `new'
from /usr/local/Homebrew/Library/Homebrew/os/mac.rb:18:in `version'
from /usr/local/Homebrew/Library/Homebrew/os/mac.rb:52:in `prerelease?'
from /usr/local/Homebrew/Library/Homebrew/os.rb:19:in `<module:OS>'
from /usr/local/Homebrew/Library/Homebrew/os.rb:1:in `<top (required)>'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /usr/local/Homebrew/Library/Homebrew/global.rb:26:in `<top (required)>'
from /usr/local/Homebrew/Library/Homebrew/brew.rb:21:in `require_relative'
from /usr/local/Homebrew/Library/Homebrew/brew.rb:21:in `<main>'
Error: Git must be installed and in your PATH!
/usr/local/Homebrew/Library/Homebrew/version.rb:366:in `initialize': Version value must be a string; got a NilClass () (TypeError)
from /usr/local/Homebrew/Library/Homebrew/os/mac/version.rb:23:in `initialize'
from /usr/local/Homebrew/Library/Homebrew/os/mac.rb:18:in `new'
from /usr/local/Homebrew/Library/Homebrew/os/mac.rb:18:in `version'
from /usr/local/Homebrew/Library/Homebrew/os/mac.rb:52:in `prerelease?'
from /usr/local/Homebrew/Library/Homebrew/os.rb:19:in `<module:OS>'
from /usr/local/Homebrew/Library/Homebrew/os.rb:1:in `<top (required)>'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /usr/local/Homebrew/Library/Homebrew/global.rb:26:in `<top (required)>'
from /usr/local/Homebrew/Library/Homebrew/brew.rb:21:in `require_relative'
from /usr/local/Homebrew/Library/Homebrew/brew.rb:21:in `<main>'
andrews-mbp:OSX-Messages-Exporter-master andrew$
2
Answers
You maybe missing xcode-select tools. try the below command.
Seems to be linked to rosetta unable to knit pdf on M2 Mac: pandoc error Applications/RStudio.app/Contents/Resources/app/quarto/bin/tools/pandoc: Bad CPU type in executable
I did run
/usr/sbin/softwareupdate --install-rosetta --agree-to-license
and things were fixed.