Alex Mendes
Alex Mendes

Reputation: 71

How to install brew on a raspberry pi?

These are my raspberry pi OS, Kernel version and archtecture configs

Operating System: Raspbian GNU/Linux 10 (buster)
Kernel: Linux 5.10.52-v7l+
Architecture: arm

When I try to run their script(https://brew.sh/):

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

I get

Homebrew on Linux is only supported on Intel processors!

and, whenever I try to run a brew command, I get:

-bash: brew: command not found

Upvotes: 3

Views: 14464

Answers (4)

Michal
Michal

Reputation: 91

Two comments on installing Homebrew on Raspberry Pi 400 Rev 1.0, Raspbian Debian 11.5.

  1. For an unknown reason Homebrew installer requires exactly ruby version 2.6.8. My Pi has ruby 2.7.4 but that was not accepted

  2. After installing 2.6.8 using the above hint (ruby-build available from the regular repository does not offer it, the next after 2.6.6 being 2.7.0), the brew update --force --verbose command was still failing on not finding 2.6.8. It was so because the 'brew' script has the PATH explicitely filtered to the system one, "/usr/bin:/bin:/usr/sbin:/sbin". Only after manually adding the path for ruby 2.6.8 did the update work. NB. the script was overwritten during the process so in order to install any package I had to add the path it again.

Any idea why it is "exactly 2.6.8" and not "2.6.8 or newer"?

Upvotes: 1

KEINOS
KEINOS

Reputation: 109

Here are my two cents on installing brew on RaspberryPi Zero W and RaspberryPi 3+ (RaspberryPi OS, bullseye).

$ # Install dependencies
$ sudo apt update -y && sudo apt upgrade -y
$ sudo apt install git

$ # Install rbenv and Ruby 2.6.8 (It takes 30-90 min.)
$ # As of 2022/06/09, ARM processors require Ruby 2.6.8.
$ # Check the gist below what is doing as well.
$ bash <(curl -sL https://gist.github.com/KEINOS/7101f542be23e5048198e2a27c3cfda8/raw/install_ruby_rpi.sh)
$ source ~/.bashrc

$ # Smoke test Ruby
$ ruby --version
ruby 2.6.8p205 (2021-07-07 revision 67951) [armv6l-linux-eabihf]

$ # Clone homebrew repo under /opt
$ sudo git clone --depth=1 https://github.com/Homebrew/brew /opt/homebrew

$ # Setup homebrew
$ sudo chown -R $(whoami) /opt/homebrew
$ echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.bashrc
$ source ~/.bashrc

$ # Full update to tap homebrew/core (It takes 30-90 min.)
$ brew update --force --verbose

$ # Smoke test brew
$ brew --version
Homebrew 3.5.1
Homebrew/homebrew-core (git revision 1d9fb5dd1e6; last commit 2022-06-09)
$ # Install "hello world" package which supports both 32bit and 64 bit ARM.
$ #   - Source: https://github.com/KEINOS/Hello-Cobra
$ #   - Formula: https://github.com/KEINOS/homebrew-Hello-Cobra
$ brew install KEINOS/Hello-Cobra/hello-cobra
***snip***
$ hello-cobra hello world
Hello, world!
$ # Env info of RaspberryPi Zero W
$ more /proc/device-tree/model
Raspberry Pi Zero W Rev 1.1
$ cat /etc/debian_version
11.3
$ uname -a
Linux rpi-zero 5.10.92+ #1514 Mon Jan 17 17:35:21 GMT 2022 armv6l GNU/Linux
$ whoami
pi
$ echo $SHELL
/bin/bash
$ # Env info of RaspberryPi 3+
$ more /proc/device-tree/model
Raspberry Pi 3 Model B Rev 1.2
$ cat /etc/debian_version
11.3
$ uname -a
Linux rpi-3pls 5.10.92-v8+ #1514 SMP PREEMPT Mon Jan 17 17:39:38 GMT 2022 aarch64 GNU/Linux
$ whoami
pi
$ echo $SHELL
/bin/bash

Note that everything for brew is slow on ARM6. Patience is required not only when setting up linuxbrew, but also when installing packages using brew.

However, once the package has been successfully installed, it should work as fast as expected. So, I'd say it is worth trying linuxbrew on the ARM6 and ARM64 architectures.

Upvotes: 2

Martin
Martin

Reputation: 1

Raspberry Pi

Homebrew can run on Raspberry Pi (32-bit ARM), but no binary packages (bottles) are available. Support for Raspberry Pi is on a best-effort basis. Pull requests are welcome to improve the experience on Raspberry Pi.

https://docs.brew.sh/Homebrew-on-Linux

Upvotes: 0

Roy Levy
Roy Levy

Reputation: 730

Homebrew for linux is called Linuxbrew. And the installation command that you need is:

sh -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)"

Please check out this link to get more info about it: https://github.com/Linuxbrew/brew

Also notice that while Linuxbrew can run on Raspberry Pi (32-bit ARM), no binary packages are available for it.

Upvotes: 5

Related Questions