简体   繁体   中英

Is there a simple way to install rails on OS X 10.11 El Capitan

The instructions for older OS don't seem to work well with system integrity protection enabled on OS X El capitan 10.11.1

What options for a http://railsinstaller.org or another one package, streamlined install to get rails running?

first of all you need ruby... as you are on OS x EL capitan you already have ruby... so first step done... ruby is the programming language... rails is the framework ... so you already have the language now you want the framework...

next is you need to install bundler (package manager for ruby):

gem install bundler

then you can install rails:

gem install rails

so now you can create a new project with:

rails new my_app_name

when you did this you will recognize that after the creation of a bunch of things it executes bundle install... so afterwards you should be able to start your app with:

rails s

If an error occurs during the installation just lookup the error by a quick google search... most of the time it is just a dependency that you are missing... also depending on which tutorial you tried you may need to start mysql first... or execute something like: rake db:create (create a database in your chosen database) and afterwards: rake db:migrate to create some tables (but this depends on the previous tutorial) try to get the welcome page from rails first ... you should get it in your browser with the adress: localhost:3000

Apple installs /usr/bin/rails to walk you through the official installation instructions as part of the core OS install if you ever run the program. Many of the old instructions will break since they don't play well with System Integrity Protection that's new on 10.11.

First make sure your command line tools are installed:

xcode-select install

Then follow the instructions (if any) you get from checking on the installed version of rails:

rails --version

this is a great site : https://gorails.com/setup/osx/10.11-el-capitan

However if you experience

ERROR:  Error installing rails:
ERROR: Failed to build gem native extension.

on terminal after using gem install you must install command line tool via Xcode -> Preferences -> Downloads or https://developer.apple.com/downloads/ if you have newer Xcode versions

If you're not using homebrew and rvm, I implore you to do so! Now that you're on a fresh install, this may be the right time to get these habits down... I know it has a learning curve, but both will make your life incredibly easier later down the road, specially rvm! :)

This article describes how a user got it done... they basically compiled a ruby on el capitan.

http://www.railsbling.com/posts/el-capitan-homebrew-ruby-qt5-java/

rvm is way better than what any railsinstaller or shellscript would...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM