Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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

This comment has been minimized.

Copy link
Owner Author

rizalp commented Jan 15, 2019

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

This comment has been minimized.

Copy link
Owner Author

rizalp commented Jan 15, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.