Skip to content

Commit c0375e5

Browse files
committed
README: add note about this fork
1 parent 05b5966 commit c0375e5

File tree

1 file changed

+80
-1
lines changed

1 file changed

+80
-1
lines changed

README.md

+80-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,83 @@
1-
# Homebrew
1+
# Homebrew for Linux ARM
2+
3+
> [!CAUTION] **This Fork**
4+
> Since this is an unsupported hack, this may eventually break.
5+
6+
> ## How to use
7+
>
8+
> All this fork does is _hack_ to allow ruby installed by rbenv to be used instead of `/usr/bin/ruby`:
9+
> [GitHub commit - Allow ruby from rbenv to take precedence](https://github.com/huyz/brew-for-linux-arm/commit/18f7e3d5a54078201430fade8ab76fadd9b282ea):
10+
>
11+
> ```bash
12+
> # filter the user environment
13+
> PATH="/usr/bin:/bin:/usr/sbin:/sbin"
14+
> PATH="${HOME}/.rbenv/shims:${PATH}"
15+
>
16+
> #FILTERED_ENV=()
17+
> FILTERED_ENV=("RBENV_VERSION=${RBENV_VERSION-}")
18+
> ```
19+
>
20+
> ### First-time Installation
21+
>
22+
> To install this Homebrew, you'll first have to install `rbenv` (e.g. Ubuntu 22.04's version from `apt` is ok):
23+
>
24+
> ```shell
25+
> git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build # apt's ruby-build is too out of date
26+
> #sudo apt install libyaml-dev
27+
> #sudo dnf install libyaml-devel
28+
> rbenv install 3.3.3
29+
> rbenv shell 3.3.3
30+
> export HOMEBREW_BREW_GIT_REMOTE=https://github.com/huyz/brew-for-linux-arm
31+
> export HOMEBREW_DEVELOPER=1
32+
> /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh | sed '532s/abort/warn/')"
33+
> ```
34+
>
35+
> You'll also need to add the core tap back (nowadays deprecated):
36+
>
37+
> ```shell
38+
> brew tap homebrew/core
39+
> ```
40+
>
41+
> After installation, to run `brew` you should probably create a `brew` wrapper that contains:
42+
>
43+
> ```bash
44+
> #!/bin/bash
45+
> [[ -d ~/.rbenv/bin ]] && export PATH="~/.rbenv/bin:$PATH"
46+
> if command -v rbenv &>/dev/null; then
47+
> export PATH="${PATH//$(rbenv root)\/shims:/}"
48+
> eval "$(rbenv init -)"
49+
> rbenv shell 3.3.3
50+
> else
51+
> echo "Warning: rbenv not found" >&2
52+
> fi
53+
> HOMEBREW_BREW_GIT_REMOTE=https://github.com/huyz/brew-for-linux-arm HOMEBREW_DEVELOPER=1 exec /home/linuxbrew/.linuxbrew/bin/brew "$@"
54+
> ```
55+
>
56+
> ### Upgrading ruby
57+
>
58+
> Occasionally, you may get an error from `brew upgrade` because the ruby version required by
59+
Homebrew will be bumped upstream. To upgrade, you can do:
60+
> ```bash
61+
> cd "$(rbenv root)"/plugins/ruby-build
62+
> git pull origin master
63+
> rbenv install 3.3.3
64+
> ```
65+
> And you should update your `brew` wrapper that you created as above:
66+
> ```bash
67+
> sed -i 's/^\([[:space:]]*rbenv shell\) .*/\1 3.3.3/' "$(which brew)"
68+
> ```
69+
>
70+
> You can then `brew upgrade` as usual.
71+
>
72+
> ## Caveats
73+
>
74+
> [!IMPORTANT] **Partial solution**
75+
> Of course, this is only half the battle. Many official formulas won't work because they weren't
76+
> written with Linux ARM in mind. (For example, as of 2024-07-19, the rust formula will fail to build.)
77+
78+
> [!WARNING] I'll try to regularly rebase my changes on top of the latest upstream commits, and then
79+
> I'll force push the new rebased commits. So you might need to `reset --hard` after fetching
80+
> updates for this repo
281
382
[![GitHub release](https://img.shields.io/github/release/Homebrew/brew.svg)](https://github.com/Homebrew/brew/releases)
483

0 commit comments

Comments
 (0)