15

I'm on the new M1 MacBook Pro. I'm trying to install gtk+3 (which has native apple silicon support) via Homebrew. First it told me

Cannot install in Homebrew on ARM processor in Intel default prefix (/usr/local)! Please create a new installation in /opt/homebrew using one of the "Alternative Installs" from: https://docs.brew.sh/Installation You can migrate your previously installed formula list with: brew bundle dump

I tried to run the terminal via Rosetta 2, but gtk+3 needs ARM support to install, so that didn't work.

I tried to manually unzip the code line in docs.brew.sh in /opt/ but it told me I don't have permission. I tried to sudo it, but to no avail. Any help?

Edit 1: for full message:

brew install gtk+3  
Updating Homebrew...
==> Auto-updated Homebrew!  
Updated 1 tap (homebrew/core).  
==> New Formulae  
libbsd  
==> Updated Formulae  
Updated 18 formulae.  

Error: Cannot install in Homebrew on ARM processor in Intel default prefix (/usr/local)! Please create a new installation in /opt/homebrew using one of the "Alternative Installs" from: https://docs.brew.sh/Installation You can migrate your previously installed formula list with: brew bundle dump

Edit 2: Created a folder called 'Home-brew' in /opt/ and opened terminal there, tried sudo and everything:

oresttokovenko@Orests-MacBook-Pro-2 Homebrew % sudo chmod 755          
Password:
usage:  chmod [-fhv] [-R [-H | -L | -P]] [-a | +a | =a  [i][# [ n]]] mode|entry file ...
    chmod [-fhv] [-R [-H | -L | -P]] [-E | -C | -N | -i | -I] file ...
oresttokovenko@Orests-MacBook-Pro-2 Homebrew % https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C homebrew
zsh: no such file or directory: https://github.com/Homebrew/brew/tarball/master
tar: could not chdir to 'homebrew'

oresttokovenko@Orests-MacBook-Pro-2 Homebrew % curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C homebrew
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   128  100   128    0     0    254      0 --:--:-- --:--:-- --:--:--   255
  0 1979k    0   598    0     0    682      0  0:49:32 --:--:--  0:49:32   682tar: could not chdir to 'homebrew'

  1 1979k    1 33478    0     0  34728      0  0:00:58 --:--:--  0:00:58  364k
curl: (23) Failed writing body (0 != 1370)
oresttokovenko@Orests-MacBook-Pro-2 Homebrew % sudo curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C homebrew
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   128  100   128    0     0    348      0 --:--:-- --:--:-- --:--:--   348
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0tar: could not chdir to 'homebrew'

  1 1979k    1 34138    0     0  41887      0  0:00:48 --:--:--  0:00:48  129k
curl: (23) Failed writing body (0 != 1370)
Paul R
  • 208,748
  • 37
  • 389
  • 560
Orest Tokovenko
  • 163
  • 1
  • 1
  • 7

3 Answers3

22

I've used the script written by Noah Rubin;

/bin/bash -c "$(curl -fsSL https://gist.githubusercontent.com/nrubin29/bea5aa83e8dfa91370fe83b62dad6dfa/raw/48f48f7fef21abb308e129a80b3214c2538fc611/homebrew_m1.sh)"

worked like a charm! Here is his youtube video on this topic for more info; https://youtu.be/nv2ylxro7rM

Edit: Forgot to mention, this script installs the homebrew into /opt/homebrew

user3479219
  • 299
  • 1
  • 8
  • The linked video here demonstrates how/when to run using Rosetta 2 and when to run natively. Nothing else I found got into this detail, and it seems important. – Kay V Dec 21 '20 at 21:03
  • Can't create update lock in /usr/local/var/homebrew/locks! Fix permissions by running: sudo chown -R $(whoami) /usr/local/var/homebrew Warning: your HOMEBREW_PREFIX is set to /usr/local but HOMEBREW_CELLAR is set to /opt/homebrew/Cellar. Your current HOMEBREW_CELLAR location will stop access to all bottles." Error: Cannot install in Homebrew ARM processor Intel default prefix (/usr/local)! Please create new installation in /opt/homebrew using one of "Alternative Installs" from: https://docs.brew.sh/InstallationYou can migrate your previously installed formula with:brew bundle dump – sejn Oct 28 '21 at 11:27
  • If I run the brew bundle dump, what will be the implications – sejn Oct 28 '21 at 11:27
4

I solved it running under the Rosetta Terminal

  1. Locate the Terminal application within the Utilities folder (Finder> Go menu > Utilities)

  2. Select Terminal.app and right-click on it, then choose “Duplicate” Rename the duplicated Terminal app something obvious and distinct, like ‘Rosetta Terminal’

  3. Now select the freshly renamed ‘Rosetta Terminal’ app and right-click and choose “Get Info” (or hit Command+i)

  4. Check the box for “Open using Rosetta”, then close the Get Info window Run the “Rosetta Terminal” as usual, which will fully support Homebrew and other x86 command line apps

sparkle
  • 7,530
  • 22
  • 69
  • 131
  • ```You are using macOS 11.0. We do not provide support for this released but not yet supported version. You will encounter build failures with some formulae. Please create pull requests instead of asking for help on Homebrew's GitHub, Twitter or any other official channels. You are responsible for resolving any issues you experience while you are running this released but not yet supported version. Error: gtk+3 dependencies not built for the x86_64 CPU architecture: python@3.9 was built for arm64 – ``` – Orest Tokovenko Nov 20 '20 at 22:32
  • 2
    this workaround works for me, also could not figure out how to actually install homebrew in `opt/homebew` as recommended by [their own documentation](https://docs.brew.sh/Installation#1) – Federico Nov 26 '20 at 02:59
0

Just for anyone coming across this now, I got the curl: (23) Failed writing body (0 != 1370) error multiple times until I realised I was running the curl/tar command from my home directory. If I cd into /opt and then run the command, it works as expected.

Charlie Niekirk
  • 1,015
  • 1
  • 10
  • 15