设置Ruby

时间:2015-06-26 03:41:31

标签: ruby-on-rails ruby macos

我一直在我的工作机器上工作的一个小项目,回家在我的笔记本电脑上试用它,当我创建一个新的rails应用程序。这是我收到的错误。

Installing i18n (0.7.0) 
Gem::InstallError: i18n requires Ruby version >= 1.9.3.
An error occured while installing i18n (0.7.0), and Bundler cannot   continue.
Make sure that `gem install i18n -v '0.7.0'` succeeds before bundling.
Jose-Gomezs-MacBook-Pro:~ josegomez$ bundle install
Could not locate Gemfile
Jose-Gomezs-MacBook-Pro:~ josegomez$ ruby -v
ruby 1.9.2p318 (2012-02-14 revision 34678) [x86_64-darwin10.8.0]

所以我尝试更新到1.9.3

rvm install ruby-1.9.3-p551

更新后我做了一个快速检查并得到了这个错误

`Error running './configure --prefix=/Users/josegomez/.rvm/rubies/ruby-   1.9.3-p551 --with-opt-dir=/opt/local --without-tcl --without-tk --disable-    install-doc --enable-shared',
showing last 15 lines of /Users/josegomez/.rvm/log/1435281659_ruby-  1.9.3-p551/configure.log
GEM_HOME=/Users/josegomez/.rvm/gems/ruby-1.9.2-p318@rails3tutorial
PATH=/Users/josegomez/.rvm/usr/bin:/opt/local/bin:/opt/local/sbin:/Users/josegomez/.rvm/gems/ruby-1.9.2-   p318@rails3tutorial/bin:/Users/josegomez/.rvm/gems/ruby-1.9.2-p318@global/bin:/Users/josegomez/.rvm/rubies/ruby-1.9.2-p318/bin:/Users/josegomez/.rvm/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/git/bin
GEM_PATH=/Users/josegomez/.rvm/gems/ruby-1.9.2-p318@rails3tutorial:/Users/josegomez/.rvm/gems/ruby-1.9.2-p318@global
command(7): ./configure --prefix=/Users/josegomez/.rvm/rubies/ruby-1.9.3-p551 --with-opt-dir=/opt/local --without-tcl --without-tk --disable-install-doc --enable-shared
configure: WARNING: unrecognized options: --without-tcl, --without-tk
checking build system type... x86_64-apple-darwin14.0.0
checking host system type... x86_64-apple-darwin14.0.0
checking target system type... x86_64-apple-darwin14.0.0
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... configure: error: in   `/Users/josegomez/.rvm/src/ruby-1.9.3-p551':
configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details
There has been an error while running configure. Halting the installation.`

当我跑步时:ruby -v我得到:

ruby(62937,0x7fff7c0c8300) malloc: *** error for object 0x100801a08: incorrect checksum for freed object - object was probably modified after being freed.
*** set a breakpoint in malloc_error_break to debug
Abort trap: 6

知道如何解决这个问题吗?

2 个答案:

答案 0 :(得分:1)

由于您使用的是MacBook Pro,我请使用以下内容。从命令行:

\curl -sSL https://get.rvm.io | bash -s stable --ruby

完成后,请尝试:

rvm use 2.2.2 --default
gem install bundler
cd /Path/to/your/rails/app
bundle install

请让我知道它是怎么回事: - )

答案 1 :(得分:0)

如果您使用的是ubuntu

,只需复制并粘贴这些命令即可
1- sudo apt-get update
2- sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev
3- sudo apt-get install libgdbm-dev libncurses5-dev automake libtool bison libffi-dev
4- \curl -sSL https://get.rvm.io | bash
5- source ~/.rvm/scripts/rvm
6- rvm install 2.2.2
7- rvm use 2.2.2 --default
8- ruby -v
9- echo "gem: --no-ri --no-rdoc" > ~/.gemrc
10- gem install bundler
11- sudo add-apt-repository ppa:chris-lea/node.js
12- sudo apt-get update
12- sudo apt-get install nodejs
14- sudo apt-get install mysql-server mysql-client libmysqlclient-dev
15- rails new myapp -d mysql
相关问题