Issue
I am trying to install PHP on my M1 Macbook using homebrew. When I run brew install php
I get the following error:
Error: php: Failed to download resource "freetds"
Download failed: Homebrew-installed `curl` is not installed for: https://www.freetds.org/files/stable/freetds-1.3.18.tar.bz2
I researched this issue and found another question addressing my specific issue:
Download failed: Homebrew-installed `curl` is not installed
The only answer on this question says to install curl, so I ran brew install curl
and let it run through a lengthy download and installation. Once this completed, I ran brew install php
once again, but I am still getting the same error, so the solution in this question did not resolve my issue.
Checking Curl
I figured that something must have gone wrong in the brew installation, so I ran it again and noticed this output at the very end:
==> Installing curl dependency: [email protected]
==> perl ./Configure --prefix=/Users/ciesinsg/homebrew/Cellar/[email protected]/1.1.1u --openssldir=/Users/
==> make
Last 15 lines from /Users/ciesinsg/Library/Logs/Homebrew/[email protected]/02.make:
clang -I. -Iinclude -fPIC -arch arm64 -O3 -Wall -DL_ENDIAN -DOPENSSL_PIC -DOPENSSL_CPUID_OBJ -DOPENSSL_BN_ASM_MONT -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DKECCAK1600_ASM -DVPAES_ASM -DECP_NISTZ256_ASM -DPOLY1305_ASM -DOPENSSLDIR="\"/Users/ciesinsg/homebrew/etc/[email protected]\"" -DENGINESDIR="\"/Users/ciesinsg/homebrew/Cellar/[email protected]/1.1.1u/lib/engines-1.1\"" -D_REENTRANT -DNDEBUG -MMD -MF crypto/sha/sha1_one.d.tmp -MT crypto/sha/sha1_one.o -c -o crypto/sha/sha1_one.o crypto/sha/sha1_one.c
clang -I. -Iinclude -fPIC -arch arm64 -O3 -Wall -DL_ENDIAN -DOPENSSL_PIC -DOPENSSL_CPUID_OBJ -DOPENSSL_BN_ASM_MONT -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DKECCAK1600_ASM -DVPAES_ASM -DECP_NISTZ256_ASM -DPOLY1305_ASM -DOPENSSLDIR="\"/Users/ciesinsg/homebrew/etc/[email protected]\"" -DENGINESDIR="\"/Users/ciesinsg/homebrew/Cellar/[email protected]/1.1.1u/lib/engines-1.1\"" -D_REENTRANT -DNDEBUG -MMD -MF crypto/sha/sha1dgst.d.tmp -MT crypto/sha/sha1dgst.o -c -o crypto/sha/sha1dgst.o crypto/sha/sha1dgst.c
CC="clang" perl crypto/sha/asm/sha512-armv8.pl ios64 crypto/sha/sha256-armv8.S
clang -I. -Iinclude -fPIC -arch arm64 -O3 -Wall -DL_ENDIAN -DOPENSSL_PIC -DOPENSSL_CPUID_OBJ -DOPENSSL_BN_ASM_MONT -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DKECCAK1600_ASM -DVPAES_ASM -DECP_NISTZ256_ASM -DPOLY1305_ASM -DOPENSSLDIR="\"/Users/ciesinsg/homebrew/etc/[email protected]\"" -DENGINESDIR="\"/Users/ciesinsg/homebrew/Cellar/[email protected]/1.1.1u/lib/engines-1.1\"" -D_REENTRANT -DNDEBUG -MMD -MF crypto/sha/sha256.d.tmp -MT crypto/sha/sha256.o -c -o crypto/sha/sha256.o crypto/sha/sha256.c
CC="clang" perl crypto/sha/asm/sha512-armv8.pl ios64 crypto/sha/sha512-armv8.S
clang -I. -Iinclude -fPIC -arch arm64 -O3 -Wall -DL_ENDIAN -DOPENSSL_PIC -DOPENSSL_CPUID_OBJ -DOPENSSL_BN_ASM_MONT -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DKECCAK1600_ASM -DVPAES_ASM -DECP_NISTZ256_ASM -DPOLY1305_ASM -DOPENSSLDIR="\"/Users/ciesinsg/homebrew/etc/[email protected]\"" -DENGINESDIR="\"/Users/ciesinsg/homebrew/Cellar/[email protected]/1.1.1u/lib/engines-1.1\"" -D_REENTRANT -DNDEBUG -MMD -MF crypto/sha/sha512.d.tmp -MT crypto/sha/sha512.o -c -o crypto/sha/sha512.o crypto/sha/sha512.c
make[1]: /bin/sh: line 1: 1129 Killed: 9 mv crypto/seed/seed_ofb.d.tmp crypto/seed/seed_ofb.d
*** [crypto/sha/sha1_one.o] Killed: 9
make[1]: *** Waiting for unfinished jobs....
make[1]: error closing STDOUT: at crypto/sha/asm/sha1-armv8.pl line 364.
*** [crypto/sha/sha1dgst.o] Killed: 9
make[1]: *** [crypto/sha/sha512.o] Killed: 9
make[1]: *** [crypto/sha/sha1-armv8.S] Error 255
make[1]: *** [crypto/seed/seed_ofb.o] Error 137
make: *** [all] Error 2
Do not report this issue to Homebrew/brew or Homebrew/homebrew-core!
I ran curl --version
and saw that a version does appear to be installed:
curl 7.88.1 (x86_64-apple-darwin22.0) libcurl/7.88.1 (SecureTransport) LibreSSL/3.3.6 zlib/1.2.11 nghttp2/1.51.0
Release-Date: 2023-02-20
Protocols: dict file ftp ftps gopher gophers http https imap imaps ldap ldaps mqtt pop3 pop3s rtsp smb smbs smtp smtps telnet tftp
Features: alt-svc AsynchDNS GSS-API HSTS HTTP2 HTTPS-proxy IPv6 Kerberos Largefile libz MultiSSL NTLM NTLM_WB SPNEGO SSL threadsafe UnixSockets
So I am not sure why it is failing to install freetds or why it is throwing the error about curl. Does anybody know what might be causing this?
Additional Info:
Macbook Pro M2 MacOS: Ventura 13.4
Solution
I posted on the Homebrew discussion portal and received some help which resolved the issue:
First, run brew doctor
to see if there's any kind of problem with the installation. In my case, due to security policies at my work, my IT team installed Homebrew in the wrong location, which resulted in the brew doctor
output:
Warning: Your Homebrew's prefix is not /opt/homebrew.
In my case, I had installed homebrew in /home/homebrew
when Apple Silicon macs should install homebrew in /home/opt/homebrew
. Please keep in mind that if you have an Intel mac, the installation location should instead be /usr/local
. Regardless, as per the docs, you should install it in the correct location for the prefix to be correct and to avoid bugs.
During my reinstall, the security policies in my company limited my access to the /opt/
folder which resulted in the error /opt/homebrew is not writeable
. I was able to resolve this by changing ownership using sudo chown -R $(whoami) /opt/homebrew
.
This finally let me complete the installation and ensure it was working out /opt/homebrew
. Running brew doctor
again resulted in the output:
Your system is ready to brew.
The problem was immediately resolved and I can now install PHP without issues.
Answered By - GeorgeCiesinski Answer Checked By - Timothy Miller (WPSolving Admin)