Skip to content

Instantly share code, notes, and snippets.

@camertron
Created July 19, 2024 15:05
Show Gist options
  • Save camertron/61475f7298eeca3e04edf28b8bb7a871 to your computer and use it in GitHub Desktop.
Save camertron/61475f7298eeca3e04edf28b8bb7a871 to your computer and use it in GitHub Desktop.
Build Ruby for iOS
#!/bin/bash
wget https://cache.ruby-lang.org/pub/ruby/3.0/ruby-3.0.2.tar.gz
tar -zxvf ruby-3.0.2.tar.gz
cd ruby-3.0.2
./configure --prefix=/tmp \
--build=x86_64-apple-darwin20 \
--target=aarch64-apple-darwin20 \
--with-gmp=/usr/local/opt/gmp \
--with-mpfr=/usr/local/opt/mpfr \
--with-mpc=/usr/local/opt/libmpc \
--with-isl=/usr/local/opt/isl \
--with-native-system-header-dir=/usr/include \
--with-sysroot=$(xcrun --sdk iphoneos --show-sdk-path) \
AS_FOR_TARGET=/usr/bin/as LD_FOR_TARGET=/usr/bin/ld \
NM_FOR_TARGET=/usr/bin/nm RANLIB_FOR_TARGET=/usr/bin/ranlib \
AR_FOR_TARGET=/usr/bin/ar LIPO_FOR_TARGET=/usr/bin/lipo \
--disable-multilib
make CC="$(xcrun --sdk iphoneos --find clang) -fdeclspec -isysroot $(xcrun --sdk iphoneos --show-sdk-path) -arch armv7 -arch armv7s -arch arm64"
make install # ruby and headers, etc will be in /tmp directory
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment