fix(desktop): evaluate MAKE_OPTS so macOS Ruby build gets a valid -jN#24
Open
rafaconrado wants to merge 1 commit into
Open
fix(desktop): evaluate MAKE_OPTS so macOS Ruby build gets a valid -jN#24rafaconrado wants to merge 1 commit into
rafaconrado wants to merge 1 commit into
Conversation
On macOS, step 4 built MAKE_OPTS with a double-quoted `bash -c` wrapping a
single-quoted, backslash-escaped \$(...). The command substitution was never
evaluated, so MAKE_OPTS was the literal string "-j$(nproc ...)". ruby-build
then ran a broken `make "-j$(nproc" 2>/dev/null || sysctl ...`, which fails:
BUILD FAILED (macOS 26.5.1 on arm64 using ruby-build ...)
rbenv: version `3.3.0' not installed
With Ruby 3.3.0 missing, the subsequent `gem install bundler rails` fell back
to system Ruby and failed with:
Gem::FilePermissionError: You don't have write permissions for the
/Library/Ruby/Gems/2.6.0 directory
Switch to single-quoted outer `bash -c` + double-quoted values so $(...) is
evaluated by the inner shell (mirrors the Linux path). Verified on macOS
(Apple Silicon, macOS 26.5.1): build now runs `make -j10` and installs
Ruby 3.3.0 successfully.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problema
No macOS, o passo
[4/14] Ruby Ecosystem (Rails)falha ao compilar o Ruby 3.3.0:Causa raiz
A linha do macOS monta
MAKE_OPTScombash -centre aspas duplas, contendo um valor entre aspas simples com\$(...):user_do bash -c "export ... export MAKE_OPTS='-j\$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 2)'; rbenv install 3.3.0"A substituição de comando nunca é avaliada —
MAKE_OPTSfica com a string literal-j$(nproc ...). O ruby-build então executa ummake "-j$(nproc" ...inválido, o build falha e o Ruby 3.3.0 não é instalado.Como consequência, o
gem install bundler railsseguinte cai no Ruby do sistema (/Library/Ruby/Gems/2.6.0) e falha comGem::FilePermissionError.Correção
Alinhar o macOS ao padrão do Linux: aspas simples no
bash -cexterno + aspas duplas nos valores, para que$(...)seja avaliado pelo shell interno. O valor continua dinâmico (-j= nº de núcleos), apenas passa a ser de fato avaliado.Teste
Verificado no macOS (Apple Silicon, macOS 26.5.1, ruby-build 20260616):
MAKE_OPTS=[-j$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 2)]→BUILD FAILED.$(...)avaliado corretamente (-j4/-j8/-j10/… conforme a máquina, com fallback-j2); o build roda-> make -jNe instala o Ruby 3.3.0 com sucesso (rbenv versionslista3.3.0), eliminando o erro de permissão nogem install.