Skip to content

Instantly share code, notes, and snippets.

@rizalp
Last active October 23, 2021 08:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save rizalp/7e55715a7ef080e1d02300c8ac018a96 to your computer and use it in GitHub Desktop.
Save rizalp/7e55715a7ef080e1d02300c8ac018a96 to your computer and use it in GitHub Desktop.
macOs Mojave Rails Setup with jemalloc and gmp

Homebrew install

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Install Libraries

brew install rbenv ruby-build sqlite3 jemalloc gmp

Add rbenv to bash so that it loads every time you open a terminal

echo 'if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi' >> ~/.bash_profile
source ~/.bash_profile

Install Ruby and Rails

RUBY_CONFIGURE_OPTS=--with-jemalloc rbenv install 2.5.3
rbenv global 2.5.3
gem install bundler
gem install rails
rbenv rehash

Generate Rails Project

rails new blog --skip-bundle
cd blog

Use homebrew sqlite3 instead of macos builtin. Replace 3.26.0 with installed version

gem install sqlite3 -- --with-sqlite3-include=/usr/local/Cellar/sqlite/3.26.0_1/include --with-sqlite3-lib=/usr/local/Cellar/sqlite/3.26.0_1/lib

Or better

bundle config build.sqlite3 --with-sqlite3-include=/usr/local/opt/sqlite/include --with-sqlite3-lib=/usr/local/opt/sqlite/lib

Finally

bundle
@rizalp
Copy link
Author

rizalp commented Jan 15, 2019

rizalps-MacBook-Pro:~ rizalp$ ruby -r rbconfig -e "puts RbConfig::CONFIG['LIBS']"
-lpthread -ljemalloc -lgmp -ldl -lobjc

@rizalp
Copy link
Author

rizalp commented Jan 15, 2019

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