Skip to content

Instantly share code, notes, and snippets.

@maveonair
Forked from thomaswitt/install_ruby_rbenv_sh
Last active December 18, 2015 03:39
Show Gist options
  • Save maveonair/5719750 to your computer and use it in GitHub Desktop.
Save maveonair/5719750 to your computer and use it in GitHub Desktop.
Installing Ruby with umlaut support when using Rbenv
#!/bin/sh
if [[ -z "$1" ]]; then
echo "No Ruby version was specified."
echo "example: install_ruby_rbenv.sh 1.9.3-p429"
exit 1
fi
RUBY_VERSION=$1
###Use this for global readline for later reuse
# OPT_DIR=/usr/local/ruby-opt/
OPT_DIR=${HOME}/.rbenv/versions/${RUBY_VERSION}/
cd /tmp
curl -O 'ftp://ftp.cwru.edu/pub/bash/readline-6.2.tar.gz'
tar xf readline-6.2.tar.gz
cd readline-6.2
export MACOSX_DEPLOYMENT_TARGET=10.5
export CFLAGS="-arch x86_64 -g -Os -pipe -no-cpp-precomp"
export CCFLAGS="-arch x86_64 -g -Os -pipe"
export CXXFLAGS="-arch x86_64 -g -Os -pipe"
export LDFLAGS="-arch x86_64 -bind_at_load"
./configure --prefix=${OPT_DIR}
cd shlib
sed -e 's/-dynamic/-dynamiclib/' Makefile > Makefile.good
mv Makefile.good Makefile
cd ..
make -j 2 && make install
cd ..
export CONFIGURE_OPTS="--with-opt-dir=${OPT_DIR} --with-readline-dir=${OPT_DIR} --enable-shared --disable-install-doc"
rbenv install -k ${RUBY_VERSION}
@maveonair
Copy link
Author

Works only with Ruby 1.9 versions!

Usage:

chmod +x install_ruby_rbenv.sh
./install_ruby_rbenv.sh 1.9.3-p429

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment