简体   繁体   English

有没有一种简单的方法可以在OS X 10.11 El Capitan上安装滑轨

[英]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 在OS X El capitan 10.11.1上启用系统完整性保护后,针对较旧OS的说明似乎无法很好地工作。

What options for a http://railsinstaller.org or another one package, streamlined install to get rails running? http://railsinstaller.org或另一个软件包(简化安装以使Rails运行)有哪些选择?

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... 首先,您需要ruby ...就像在OS x EL capitan上一样,您已经有了ruby ...所以第一步已经完成了。现在您想要的语言是框架...

next is you need to install bundler (package manager for ruby): 接下来是您需要安装捆绑程序(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 如果在安装过程中发生错误,则可以通过快速的Google搜索来查找错误...在大多数情况下,这只是缺少的依赖项...还取决于您尝试的教程,您可能需要先启动mysql。 ..或执行类似的操作:rake db:create(在您选择的数据库中创建一个数据库),然后执行以下操作:rake db:migrate创建一些表(但这取决于前面的教程),尝试首先从rails获取欢迎页面。 ..您应该使用以下地址在浏览器中获取它: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. 如果您运行程序,Apple将安装/usr/bin/rails来指导您完成正式安装说明,这是核心操作系统安装的一部分。 Many of the old instructions will break since they don't play well with System Integrity Protection that's new on 10.11. 许多旧的说明会中断,因为它们不能与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的安装版本中获得的说明进行操作:

rails --version

this is a great site : https://gorails.com/setup/osx/10.11-el-capitan 这是一个很棒的网站: 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 使用gem安装后,在终端上必须通过Xcode-> Preferences-> Downloads或https://developer.apple.com/downloads/(如果您有较新的Xcode版本)安装命令行工具

If you're not using homebrew and rvm, I implore you to do so! 如果您不使用自制软件和rvm,我恳请您这样做! 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! 现在您正在全新安装,这可能是降低这些习惯的正确时机……我知道它具有学习上的曲线,但是两者都会使您的生活变得异常轻松,尤其是rvm! :) :)

This article describes how a user got it done... they basically compiled a ruby on el capitan. 本文介绍了用户如何完成此工作...他们基本上是在capitan上编译了一个ruby。

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

rvm is way better than what any railsinstaller or shellscript would... rvm比任何railsinstaller或shellscript都好...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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