-
Notifications
You must be signed in to change notification settings - Fork 1
Setting Up Your Development Environment (OS X)
Follow all the steps in the GoRails setup guide, but be sure to reference the extra information in the SDMP Dev Rails Setup Guide as you go. GoRails omits a lot of key information and extra steps in the name of expediency, so you should follow along with this guide as you use the GoRails guide.
This guide contains the extra info we need that the GoRails guide omits. If there was overlap with their guide and no additional information, then that section won't appear here (hence no rbenv installation section).
If for some reason the Homebrew install script doesn't do it for you, you should download the latest XCode Command Line Tools.
If you have a Terminal window / tab open, close it and reopen it.
After you install, then run brew doctor
to check for any potential conflicts. Do everything brew doctor
recommends you do.
To set up tab completion, see: https://github.com/mxcl/homebrew/wiki/Tips-N%27-Tricks#command-tab-completion
brew install git
Although OS X ships with git, it's pretty old, so you'll want to use the latest version.
brew install mysql
Although you could compile it yourself without a package manager, the uninstallation process (whenever you need to upgrade) is a mofo. Having homebrew manage it is much easier. If you are concerned about having homebrew automatically upgrade it without your consent, you can always run: brew pin mysql
rbenv install <version>
Each Dev project should specify its required Ruby version and patch level. https://github.com/sstephenson/rbenv/#installing-ruby-versions
See all of the versions available for install with rbenv install --list
rbenv rehash
This command installs shims for all Ruby executables so that rbenv can access them – always run this after installing a new version of Ruby!
You should install either Sublime Text 3, Vim, or Atom.
Are you experiencing errors like:
BUILD FAILED
Inspect or clean up the working tree at /var/folders/8h/4rglm83j74dcb2p7vx1n178c0000gn/T/ruby-build.20130913111331.25306
Results logged to /var/folders/8h/4rglm83j74dcb2p7vx1n178c0000gn/T/ruby-build.20130913111331.25306.log
Last 10 log lines:
readline.c:1688: error: ‘username_completion_function’ undeclared (first use in this function)
readline.c:1688: error: (Each undeclared identifier is reported only once
readline.c:1688: error: for each function it appears in.)
make[2]: *** [readline.o] Error 1
make[1]: *** [ext/readline/all] Error 2
make[1]: *** Waiting for unfinished jobs....
installing default cparse libraries
linking shared-object racc/cparse.bundle
ld: warning: directory not found for option '-L/Users/username/.rbenv/versions/2.0.0-p247/lib'
make: *** [build-ext] Error 2
or
BUILD FAILED
Inspect or clean up the working tree at /var/folders/8h/4rglm83j74dcb2p7vx1n178c0000gn/T/ruby-build.20130913110732.3321
Results logged to /var/folders/8h/4rglm83j74dcb2p7vx1n178c0000gn/T/ruby-build.20130913110732.3321.log
Last 10 log lines:
compiling ossl_x509cert.c
compiling ossl_x509crl.c
compiling ossl_x509ext.c
compiling ossl_x509name.c
compiling ossl_x509req.c
compiling ossl_x509revoked.c
compiling ossl_x509store.c
installing default openssl libraries
linking shared-object openssl.bundle
make: *** [build-ext] Error 2
or
BUILD FAILED
Inspect or clean up the working tree at /var/folders/8h/4rglm83j74dcb2p7vx1n178c0000gn/T/ruby-build.20130913110305.80528
Results logged to /var/folders/8h/4rglm83j74dcb2p7vx1n178c0000gn/T/ruby-build.20130913110305.80528.log
Last 10 log lines:
ossl_x509store.c:520: warning: ‘X509_STORE_CTX_set_flags’ is deprecated (declared at /usr/include/openssl/x509_vfy.h:464)
ossl_x509store.c: In function ‘ossl_x509stctx_set_purpose’:
ossl_x509store.c:532: warning: ‘X509_STORE_CTX_set_purpose’ is deprecated (declared at /usr/include/openssl/x509_vfy.h:460)
ossl_x509store.c: In function ‘ossl_x509stctx_set_trust’:
ossl_x509store.c:544: warning: ‘X509_STORE_CTX_set_trust’ is deprecated (declared at /usr/include/openssl/x509_vfy.h:461)
ossl_x509store.c: In function ‘ossl_x509stctx_set_time’:
ossl_x509store.c:561: warning: ‘X509_STORE_CTX_set_time’ is deprecated (declared at /usr/include/openssl/x509_vfy.h:466)
installing default openssl libraries
linking shared-object openssl.bundle
make: *** [build-ext] Error 2
?
There are probably one or two problems here: you have an old, incompatible version of the openssl and/or readline libraries installed, or rbenv / ruby-build can't find them. To fix:
brew install openssl
brew install readline
Then try installing with the following options:
RUBY_CONFIGURE_OPTS="--with-readline-dir=$(brew --prefix readline) --with-openssl-dir=$(brew --prefix openssl)" rbenv install 2.0.0-p247
What is this witchcraft?! Nothing too crazy – RUBY_CONFIGURE_OPTS
is an option provided by ruby-build which allows you to pass build options to the compiler script. The options --with-readline-dir
and --with-openssl-dir
should be pretty straightforward, and brew --prefix [program_name]
just returns the install directory of the program installed via homebrew.
And if this doesn't work, then, damn.