Coder Social home page Coder Social logo

rbenv / ruby-build Goto Github PK

View Code? Open in Web Editor NEW
3.9K 3.9K 782.0 3.17 MB

A tool to download, compile, and install Ruby on Unix-like systems.

Home Page: https://rbenv.org/man/ruby-build.1

License: MIT License

Shell 67.94% Roff 31.57% Ruby 0.32% Makefile 0.16%
hacktoberfest rbenv-plugin ruby version-manager

ruby-build's Introduction

Seamlessly manage your app’s Ruby environment with rbenv.

rbenv is a version manager tool for the Ruby programming language on Unix-like systems. It is useful for switching between multiple Ruby versions on the same machine and for ensuring that each project you are working on always runs on the correct Ruby version.

How It Works

After rbenv injects itself into your PATH at installation time, any invocation of ruby, gem, bundler, or other Ruby-related executable will first activate rbenv. Then, rbenv scans the current project directory for a file named .ruby-version. If found, that file determines the version of Ruby that should be used within that directory. Finally, rbenv looks up that Ruby version among those installed under ~/.rbenv/versions/.

You can choose the Ruby version for your project with, for example:

cd myproject
# choose Ruby version 3.1.2:
rbenv local 3.1.2

Doing so will create or update the .ruby-version file in the current directory with the version that you've chosen. A different project of yours that is another directory might be using a different version of Ruby altogether—rbenv will seamlessly transition from one Ruby version to another when you switch projects.

Finally, almost every aspect of rbenv's mechanism is customizable via plugins written in bash.

The simplicity of rbenv has its benefits, but also some downsides. See the comparison of version managers for more details and some alternatives.

Installation

On systems with Homebrew package manager, the “Using Package Managers” method is recommended. On other systems, “Basic Git Checkout” might be the easiest way of ensuring that you are always installing the latest version of rbenv.

Using Package Managers

  1. Install rbenv using one of the following approaches.

    Homebrew

    On macOS or Linux, we recommend installing rbenv with Homebrew.

    brew install rbenv ruby-build

    Debian, Ubuntu, and their derivatives

    Note that the version of rbenv that is packaged and maintained in the Debian and Ubuntu repositories is out of date. To install the latest version, it is recommended to install rbenv using git.

    sudo apt install rbenv

    Arch Linux and its derivatives

    Archlinux has an AUR Package for rbenv and you can install it from the AUR using the instructions from this wiki page.

  2. Set up your shell to load rbenv.

    rbenv init
  3. Close your Terminal window and open a new one so your changes take effect.

That's it! You are now ready to install some Ruby versions.

Basic Git Checkout

Note

For a more automated install, you can use rbenv-installer. If you do not want to execute scripts downloaded from a web URL or simply prefer a manual approach, follow the steps below.

This will get you going with the latest version of rbenv without needing a system-wide install.

  1. Clone rbenv into ~/.rbenv.

    git clone https://github.com/rbenv/rbenv.git ~/.rbenv
  2. Set up your shell to load rbenv.

    ~/.rbenv/bin/rbenv init

    If you are curious, see here to understand what init does.

  3. Restart your shell so that these changes take effect. (Opening a new terminal tab will usually do it.)

Shell completions

When manually installing rbenv, it might be useful to note how completion scripts for various shells work. Completion scripts help with typing rbenv commands by expanding partially entered rbenv command names and option flags; typically this is invoked by pressing Tab key in an interactive shell.

  • The bash completion script for rbenv ships with the project and gets loaded by the rbenv init mechanism.

  • The zsh completion script ships with the project, but needs to be added to FPATH in zsh before it can be discovered by the shell. One way to do this would be to edit ~/.zshrc:

    # assuming that rbenv was installed to `~/.rbenv`
    FPATH=~/.rbenv/completions:"$FPATH"
    
    autoload -U compinit
    compinit
  • The fish completion script for rbenv ships with the fish shell itself and is not maintained by the rbenv project.

Installing Ruby versions

The rbenv install command does not ship with rbenv out-of-the-box, but is provided by the ruby-build plugin.

Before attempting to install Ruby, check that your build environment has the necessary tools and libraries. Then:

# list latest stable versions:
rbenv install -l

# list all local versions:
rbenv install -L

# install a Ruby version:
rbenv install 3.1.2

For troubleshooting BUILD FAILED scenarios, check the ruby-build Discussions section.

Note

If the rbenv install command wasn't found, you can install ruby-build as a plugin:

git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build

Set a Ruby version to finish installation and start using Ruby:

rbenv global 3.1.2   # set the default Ruby version for this machine
# or:
rbenv local 3.1.2    # set the Ruby version for this directory

Alternatively to the rbenv install command, you can download and compile Ruby manually as a subdirectory of ~/.rbenv/versions. An entry in that directory can also be a symlink to a Ruby version installed elsewhere on the filesystem.

Installing Ruby gems

Select a Ruby version for your project using rbenv local 3.1.2, for example. Then, proceed to install gems as you normally would:

gem install bundler

Warning

You should not use sudo to install gems. Typically, the Ruby versions will be installed under your home directory and thus writeable by your user. If you get the “you don't have write permissions” error when installing gems, it's likely that your "system" Ruby version is still a global default. Change that with rbenv global <version> and try again.

Check the location where gems are being installed with gem env:

gem env home
# => ~/.rbenv/versions/<version>/lib/ruby/gems/...

Uninstalling Ruby versions

As time goes on, Ruby versions you install will accumulate in your ~/.rbenv/versions directory.

To remove old Ruby versions, simply rm -rf the directory of the version you want to remove. You can find the directory of a particular Ruby version with the rbenv prefix command, e.g. rbenv prefix 2.7.0.

The ruby-build plugin provides an rbenv uninstall command to automate the removal process.

Command Reference

The main rbenv commands you need to know are:

rbenv versions

Lists all Ruby versions known to rbenv, and shows an asterisk next to the currently active version.

$ rbenv versions
  1.8.7-p352
  1.9.2-p290
* 1.9.3-p327 (set by /Users/sam/.rbenv/version)
  jruby-1.7.1
  rbx-1.2.4
  ree-1.8.7-2011.03

rbenv version

Displays the currently active Ruby version, along with information on how it was set.

$ rbenv version
1.9.3-p327 (set by /Users/sam/.rbenv/version)

rbenv local

Sets a local application-specific Ruby version by writing the version name to a .ruby-version file in the current directory. This version overrides the global version, and can be overridden itself by setting the RBENV_VERSION environment variable or with the rbenv shell command.

rbenv local 3.1.2

When run without a version number, rbenv local reports the currently configured local version. You can also unset the local version:

rbenv local --unset

rbenv global

Sets the global version of Ruby to be used in all shells by writing the version name to the ~/.rbenv/version file. This version can be overridden by an application-specific .ruby-version file, or by setting the RBENV_VERSION environment variable.

rbenv global 3.1.2

The special version name system tells rbenv to use the system Ruby (detected by searching your $PATH).

When run without a version number, rbenv global reports the currently configured global version.

rbenv shell

Sets a shell-specific Ruby version by setting the RBENV_VERSION environment variable in your shell. This version overrides application-specific versions and the global version.

rbenv shell jruby-1.7.1

When run without a version number, rbenv shell reports the current value of RBENV_VERSION. You can also unset the shell version:

rbenv shell --unset

Note that you'll need rbenv's shell integration enabled (step 3 of the installation instructions) in order to use this command. If you prefer not to use shell integration, you may simply set the RBENV_VERSION variable yourself:

export RBENV_VERSION=jruby-1.7.1

rbenv rehash

Installs shims for all Ruby executables known to rbenv (~/.rbenv/versions/*/bin/*). Typically you do not need to run this command, as it will run automatically after installing gems.

rbenv rehash

rbenv which

Displays the full path to the executable that rbenv will invoke when you run the given command.

$ rbenv which irb
/Users/sam/.rbenv/versions/1.9.3-p327/bin/irb

rbenv whence

Lists all Ruby versions that contain the specified executable name.

$ rbenv whence rackup
1.9.3-p327
jruby-1.7.1
ree-1.8.7-2011.03

Environment variables

You can affect how rbenv operates with the following settings:

name default description
RBENV_VERSION Specifies the Ruby version to be used.
Also see rbenv shell
RBENV_ROOT ~/.rbenv Defines the directory under which Ruby versions and shims reside.
Also see rbenv root
RBENV_DEBUG Outputs debug information.
Also as: rbenv --debug <subcommand>
RBENV_HOOK_PATH see wiki Colon-separated list of paths searched for rbenv hooks.
RBENV_DIR $PWD Directory to start searching for .ruby-version files.

How rbenv hooks into your shell

rbenv init is a helper command to bootstrap rbenv into a shell. This helper is part of the recommended installation instructions, but optional, as an advanced user can set up the following tasks manually. Here is what the command does when its output is eval'd by a shell during its startup:

  1. Adds rbenv executable to PATH if necessary.

  2. Prepends ~/.rbenv/shims directory to PATH. This is basically the only requirement for rbenv to function properly.

  3. Installs bash shell completion for rbenv commands.

  4. Regenerates rbenv shims. If this step slows down your shell startup, you can invoke rbenv init - with the --no-rehash flag.

  5. Installs the "sh" dispatcher. This bit is also optional, but allows rbenv and plugins to change variables in your current shell, making commands like rbenv shell possible.

You can run rbenv init - for yourself to inspect the generated script.

Uninstalling rbenv

The simplicity of rbenv makes it easy to temporarily disable it, or uninstall from the system.

  1. To disable rbenv managing your Ruby versions, simply comment or remove the rbenv init line from your shell startup configuration. This will remove rbenv shims directory from PATH, and future invocations like ruby will execute the system Ruby version, bypassing rbenv completely.

    While disabled, rbenv will still be accessible on the command line, but your Ruby apps won't be affected by version switching.

  2. To completely uninstall rbenv, perform step (1) and then remove the rbenv root directory. This will delete all Ruby versions that were installed under `rbenv root`/versions/:

    rm -rf "$(rbenv root)"
    

    If you've installed rbenv using a package manager, as a final step perform the rbenv package removal:

    • Homebrew: brew uninstall rbenv
    • Debian, Ubuntu, and their derivatives: sudo apt purge rbenv
    • Archlinux and its derivatives: sudo pacman -R rbenv

Development

Tests are executed using Bats:

$ bats test
$ bats test/<file>.bats

Please feel free to submit pull requests and file bugs on the issue tracker.

ruby-build's People

Contributors

bensie avatar byroot avatar chrisseaton avatar deepj avatar dependabot[bot] avatar eregon avatar eric avatar guilleiguaran avatar headius avatar hsbt avatar jas14 avatar jasonkarns avatar jc00ke avatar jeremy avatar jnozsc avatar josh avatar koic avatar metalefty avatar mislav avatar msp-greg avatar nirvdrum avatar noahgibbs avatar raggi avatar reedloden avatar sferik avatar sorah avatar sstephenson avatar toy avatar yuichiro-naito avatar yyuu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ruby-build's Issues

ree-1.8.7-2011.03 fails to install on OSX Lion (readline issues)

I came across this issue with ruby-build, OSX Lion and REE (ree-1.8.7-2011.03)
Basically I couldn't install it properly due to common Readline issues, mentioned here

readline.c: In function ‘username_completion_proc_call’:  
readline.c:734: error: ‘username_completion_function’ undeclared (first use in this function)  
readline.c:734: error: (Each undeclared identifier is reported only once  
readline.c:734: error: for each function it appears in.)  
make[1]: *** [readline.o] Error 1 

I have readline installed OK (via brew) to /usr/local/Cellar/readline/6.2.1and the solution is to supply the REE installer with the --with-readline-dir configure option. So naturally I tried;

CONFIGURE_OPTS="--with-readline-dir=$(brew --prefix readline)" rbenv install ree-1.8.7-2011.03

Unfortunately, looking in the code for ruby-build, it seems that CONFIGURE_OPTS is ignored for REE installs

The build_package_ree_installer method pays no attention to the CONFIGURE_OPTS environment variable.

To compound the problem on OSX Lion, we can't simply use CONFIGURE_OPTS as an argument to the REE ./installer command, since its prefixed with '--with-gcc' set in the use_gcc42_on_lion method.

My suggested fix below introduces a new env variable, REE_CONFIGURE_OPTS, used only in the build_package_ree_installer method. With this patch applied, I could now successfully install REE on OSX Lion with the following command to rbenv;

REE_CONFIGURE_OPTS="-c --enable-shared -c --with-readline-dir=$(brew --prefix readline)" rbenv install ree-1.8.7-2011.03

Any questions or comments, or if you've had the same problem please let me know.

Matt

Patch

- 138:  { ./installer --auto "$PREFIX_PATH" --dont-install-useful-gems $options
+ 138: { ./installer --auto "$PREFIX_PATH" --dont-install-useful-gems $options $REE_CONFIGURE_OPTS 

Try Install ree-1.8.7-2011.03 and 1.9.3.-rc1 - BUILD FAILED

~ $ rbenv install ree-1.8.7-2011.03
Downloading http://rubyenterpriseedition.googlecode.com/files/ruby-enterprise-1.8.7-2011.03.tar.gz...
Installing ruby-enterprise-1.8.7-2011.03...

BUILD FAILED

Inspect or clean up the working tree at /var/folders/v1/wfk93jv14q1_9hxlhs4f0qfh0000gn/T/ruby-build.20111021133605.1745
Results logged to /var/folders/v1/wfk93jv14q1_9hxlhs4f0qfh0000gn/T/ruby-build.20111021133605.1745.log

and 1.9.3-rc1 is same case

definition for jruby-1.6.3 sed command

Hi,

I'm using rbenv and ruby-build on my mac and it works great, many thanks for releasing this. I tried to use it on my ubuntu box at work and the sed command:

sed -i "" 's/^#!/bin/bash/#!/usr/bin/env bash/' jruby

barfs due to the empty string args for edit in place. This works fine:

sed -i 's/^#!/bin/bash/#!/usr/bin/env bash/' jruby

however, i imagine that does not work for mac. Just thought I would let you know... I guess there could be separate definitions for linux but this seems like a shame. I just edited it by hand as it is a one-off install for me...

Thanks,
gaz

ruby build always downloads the tar file when attempting build

I am trying to integrate ruby-build into a puppet recipe and while testing I noticed that it downloads the tar file every time I call it. Apparently it doesn't keep the tar file around or it does not check before downloading again.

wget -nc works nicely in these situations.

Command to update defintions

It would be nice to have a command to update definitions. Something like:

ruby-build definitions update

At this moment to have this behavior we usually have to run.

cd ~/Sources/ruby-build
git pull
./install.sh

Keep the sources cached

Hello,

I tried ruby-build along with rbenv and I like it but I think it would be even better if it was able to cache the source code of a ruby version.

For instance, today I rebuilt my Ruby 1.9.3 many times (the first time, the second time since I din't have zlib, the third time since I didn't have openssl compilation option) and the download step is quite long and useless. I would be glad to have some cache directory in .rbenv to shorten this step.

What do you think about that? Can I help?

1.9.2 on lion

is there a reason why the 1.9.2 recipe does not include "use_gcc42_on_lion" ?
I had to add it or else I got crash every time I executed a ruby application if compiled with llvm.

Ruby-build not detecting gcc

Installed rbenv and ruby-build today and when I try and install a Ruby I get an error that a suitable gcc binary couldn't be found.

~ $ rbenv install 1.9.2-p290

ERROR: This package must be compiled with GCC, and we
couldn't find a suitable `gcc' binary on your system.
Please install GCC and try again.

You can install these GCC packages on Mac OS X:
https://github.com/kennethreitz/osx-gcc-installer/downloads


BUILD FAILED

Inspect or clean up the working tree at /var/folders/df/2c1r37kd52l_5t54bb25xwt80000gn/T/ruby-build.20111023123010.330

 ~ $ which gcc
/usr/bin/gcc

 ~ $ gcc
i686-apple-darwin11-llvm-gcc-4.2: no input files

 ~ $ ruby-build
ruby-build 20110928
usage: ruby-build [-v|--verbose] definition prefix
       ruby-build --definitions

Patch 1.9.2-p290

Ruby 1.9.2-p290 (at least built with ruby-build, 1.9.2-p290 from RVM worked fine) seems to have strange issues with pry and yard. More about them pry/pry#215. lsegal suggested to apply this patch — ruby/ruby@be953b4
Maybe ruby-build should apply it by default?

Depend on reliable 3rd party sites (not pyyaml.org)

Hello,

pyyaml.org has been down for a while now and this prevents use of ruby-build.

I'd suggest depending only on reliable 3rd party sites to deliver dependencies. Maybe some GitHub mirror like https://github.com/yaml/libyaml (although this one is probably outdated).

Here's what ruby-build prints:

Downloading http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz...

BUILD FAILED

Inspect or clean up the working tree at /tmp/ruby-build.20111207111740.8294
Results logged to /tmp/ruby-build.20111207111740.8294.log

Last 10 log lines:
/tmp/ruby-build.20111207111740.8294 ~
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                             Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:--  0:04:24 --:--:--     0
curl: (56) Recv failure: Connection reset by peer

GCC error on Lion 10.7.2 and XCode 4.2 fresh install

Seems that latest XCode 4.2 don't install (non-llvm) gcc-4.2 anymore.

$ ls -l /usr/bin | grep gcc

lrwxr-xr-x    1 wsouto  wheel    12B 14 Out 17:55 cc -> llvm-gcc-4.2
lrwxr-xr-x    1 wsouto  wheel    12B 14 Out 17:55 gcc -> llvm-gcc-4.2
lrwxr-xr-x    1 wsouto  admin    52B 14 Out 17:55 i686-apple-darwin11-llvm-g++-4.2 -> ../llvm-gcc-4.2/bin/i686-apple-darwin11llvm-g++-4.2
lrwxr-xr-x    1 wsouto  admin    52B 14 Out 17:55 i686-apple-darwin11-llvm-gcc-4.2 -> ../llvm-gcc-4.2/bin/i686-apple-darwin11-llvm-gcc-4.2
lrwxr-xr-x    1 wsouto  admin    32B 14 Out 17:55 llvm-cpp-4.2 -> ../llvm-gcc-4.2/bin/llvm-cpp-4.2
lrwxr-xr-x    1 wsouto  admin    32B 14 Out 17:55 llvm-g++ -> ../llvm-gcc-4.2/bin/llvm-g++-4.2
lrwxr-xr-x    1 wsouto  admin    32B 14 Out 17:55 llvm-g++-4.2 -> ../llvm-gcc-4.2/bin/llvm-g++-4.2
lrwxr-xr-x    1 wsouto  admin    32B 14 Out 17:55 llvm-gcc -> ../llvm-gcc-4.2/bin/llvm-gcc-4.2
lrwxr-xr-x    1 wsouto  admin    32B 14 Out 17:55 llvm-gcc-4.2 -> ../llvm-gcc-4.2/bin/llvm-gcc-4.2

Installing the osx-gcc-installer solves the problem for now.

This info might be useful for someone...

Binary packages

I'd like to add binary package support to ruby-build. I'd guess that most ruby-build installations are on one of two platforms—Mac OS X x86_64 or Linux x86_64—and most people really don't need to compile their own Ruby runtimes. Binary packages would make it much quicker to get up and running.

In order to do this, we'll need a command to build a definition into a temporary directory and make a tarball. We'll also need a way to download and install package tarballs from the internet. This implies having package repository sources, an architecture naming system, and an index of packages with checksums.

Submit to Homebrew

We told the homebrew guys to hold off until we did a proper tagged release.

1.9.3 can't find SHA on Lion?

Anyone else seeing this?

I'm getting this issue with my brand new 1.9.3 build:

~/.rbenv/shims/bundle help

$HOME/.rbenv/versions/1.9.3-preview1/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in require': dlopen($HOME/.rbenv/versions/1.9.3-preview1/lib/ruby/1.9.1/x86_64-darwin11.1.0/digest/sha1.bundle, 9): Symbol not found: _rb_Digest_SHA1_Finish (LoadError) Referenced from: $HOME/.rbenv/versions/1.9.3-preview1/lib/ruby/1.9.1/x86_64-darwin11.1.0/digest/sha1.bundle Expected in: flat namespace in $HOME/.rbenv/versions/1.9.3-preview1/lib/ruby/1.9.1/x86_64-darwin11.1.0/digest/sha1.bundle - $HOME/.rbenv/versions/1.9.3-preview1/lib/ruby/1.9.1/x86_64-darwin11.1.0/digest/sha1.bundle from $HOME/.rbenv/versions/1.9.3-preview1/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:inrequire'
from $HOME/.rbenv/versions/1.9.3-preview1/lib/ruby/gems/1.9.1/gems/bundler-1.0.18/lib/bundler/definition.rb:1:in <top (required)>' from $HOME/.rbenv/versions/1.9.3-preview1/lib/ruby/gems/1.9.1/gems/bundler-1.0.18/lib/bundler.rb:136:indefinition'
from $HOME/.rbenv/versions/1.9.3-preview1/lib/ruby/gems/1.9.1/gems/bundler-1.0.18/lib/bundler/cli.rb:220:in install' from $HOME/.rbenv/versions/1.9.3-preview1/lib/ruby/gems/1.9.1/gems/bundler-1.0.18/lib/bundler/vendor/thor/task.rb:22:inrun'
from $HOME/.rbenv/versions/1.9.3-preview1/lib/ruby/gems/1.9.1/gems/bundler-1.0.18/lib/bundler/vendor/thor/invocation.rb:118:in invoke_task' from $HOME/.rbenv/versions/1.9.3-preview1/lib/ruby/gems/1.9.1/gems/bundler-1.0.18/lib/bundler/vendor/thor.rb:263:indispatch'
from $HOME/.rbenv/versions/1.9.3-preview1/lib/ruby/gems/1.9.1/gems/bundler-1.0.18/lib/bundler/vendor/thor/base.rb:386:in start' from $HOME/.rbenv/versions/1.9.3-preview1/lib/ruby/gems/1.9.1/gems/bundler-1.0.18/bin/bundle:13:in<top (required)>'
from $HOME/.rbenv/versions/1.9.3-preview1/bin/bundle:19:in load' from $HOME/.rbenv/versions/1.9.3-preview1/bin/bundle:19:in

'

Installing jruby-1.6.4

I cannot install jruby-1.6.4 using rbenv. I can install other Rubies (e.g. 1.9.2-p290). I am using Mac OS X 10.7.

~ $ echo $PATH
/Users/harrigan/.rbenv/shims:/Users/harrigan/.rbenv/bin:/Users/harrigan/bin:/Users/harrigan/.gem/ruby/1.9.1/bin:/usr/local/bin:/usr/local/lib/ruby/gems/1.9.1:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/texbin
~ $ ruby-build --definitions
1.8.6-p420
1.8.7-p249
1.8.7-p352
1.9.1-p378
1.9.2-p290
1.9.3-preview1
jruby-1.6.3
jruby-1.6.4
rbx-1.2.4
ree-1.8.7-2011.03
~ $ ruby-build jruby-1.6.4 ~/.rbenv/versions/jruby-1.6.4
Downloading http://jruby.org.s3.amazonaws.com/downloads/1.6.4/jruby-bin-1.6.4.tar.gz...
Installing jruby-1.6.4...
sed: can't read s/^#!\/bin\/bash/#!\/usr\/bin\/env bash/: No such file or directory

BUILD FAILED

Inspect or clean up the working tree at /var/folders/n0/z80bfnt150z6lk0x20s81_r80000gn/T/ruby-build.20110907172953.18163
Results logged to /var/folders/n0/z80bfnt150z6lk0x20s81_r80000gn/T/ruby-build.20110907172953.18163.log

REE is installed with wrong/no readline

for REE, when I paste into irb or pry, the characters come in very slowly. it's the problem described here:

I'm working on a ruby-build solution for this now (although I'm not exactly sure what that is -- the discussions at those questions and elsewhere on the web is never quite clear about what the cause is -- a particular version of readline? I'm going to look at the RVM solution)

Is it worth fixing at the ruby-build level? Have others experience this problem? I'm on 10.6.8

ree-1.8.7-2011.03 fails to build with openssl 1.0.0

rbenv install ree-1.8.7-2011.03

ossl_ssl.c:101:5: warning: initialization from incompatible pointer type [enabled by default]
ossl_ssl.c:101:5: warning: (near initialization for 'ossl_ssl_method_tab[0].func') [enabled by default]
ossl_ssl.c:102:5: warning: initialization from incompatible pointer type [enabled by default]
ossl_ssl.c:102:5: warning: (near initialization for 'ossl_ssl_method_tab[1].func') [enabled by default]
ossl_ssl.c:103:5: warning: initialization from incompatible pointer type [enabled by default]
ossl_ssl.c:103:5: warning: (near initialization for 'ossl_ssl_method_tab[2].func') [enabled by default]
ossl_ssl.c:104:1: error: 'SSLv2_method' undeclared here (not in a function)
ossl_ssl.c:105:1: error: 'SSLv2_server_method' undeclared here (not in a function)
ossl_ssl.c:106:1: error: 'SSLv2_client_method' undeclared here (not in a function)
ossl_ssl.c:107:5: warning: initialization from incompatible pointer type [enabled by default]
ossl_ssl.c:107:5: warning: (near initialization for 'ossl_ssl_method_tab[6].func') [enabled by default]
ossl_ssl.c:108:5: warning: initialization from incompatible pointer type [enabled by default]
ossl_ssl.c:108:5: warning: (near initialization for 'ossl_ssl_method_tab[7].func') [enabled by default]
ossl_ssl.c:109:5: warning: initialization from incompatible pointer type [enabled by default]
ossl_ssl.c:109:5: warning: (near initialization for 'ossl_ssl_method_tab[8].func') [enabled by default]
ossl_ssl.c:110:5: warning: initialization from incompatible pointer type [enabled by default]
ossl_ssl.c:110:5: warning: (near initialization for 'ossl_ssl_method_tab[9].func') [enabled by default]
ossl_ssl.c:111:5: warning: initialization from incompatible pointer type [enabled by default]
ossl_ssl.c:111:5: warning: (near initialization for 'ossl_ssl_method_tab[10].func') [enabled by default]
ossl_ssl.c:112:5: warning: initialization from incompatible pointer type [enabled by default]
ossl_ssl.c:112:5: warning: (near initialization for 'ossl_ssl_method_tab[11].func') [enabled by default]
ossl_ssl.c: In function 'ossl_ssl_get_cipher':
ossl_ssl.c:1224:12: warning: assignment discards 'const' qualifier from pointer target type [enabled by default]
make[1]: *** [ossl_ssl.o] Error 1
make[1]: Leaving directory `/tmp/ruby-build.20111026110110.14103/ruby-enterprise-1.8.7-2011.03/source/ext/openssl'
make: *** [all] Error 1

This by itself is a known issue, see http://bit.ly/sa4TAo

But there's no way to pass a patch to ruby-build to overcome this.

Allow Patching Hook?

On some machines (like mine), ruby 1.8.7 won't compile, but there is a patch: http://redmine.ruby-lang.org/issues/5108

I imagine there would be other reasons you might want to patch ruby as you installed it. I would probably figure out how to write a definition that would replicate what I just did by hand for my specific patch. Would people rather see that pull request, or do folks think it would be useful to have some way to tell ruby-build to apply some patch file before building whatever version of ruby?

Build failed when installing REE as it complains about OpenSSL

Cross posted from rbenv/rbenv#132.

@josh recommends that I pass in some config options, however I'm unsure as what I should be passing in.

I'm running Ubuntu 11.10 and can't install ree-1.8.7-2011.03, though installing 1.8.7-p352 worked fine. OpenSSL is installed. See below a snippet of the log from the build failure. I can't figure out as to why this is happening?

ossl_x509name.c: In function ‘ossl_x509name_initialize’:
ossl_x509name.c:143:35: warning: passing argument 2 of ‘d2i_X509_NAME’ from incompatible pointer type [enabled by default]
/usr/include/openssl/x509.h:828:1: note: expected ‘const unsigned char ’ but argument is of type ‘unsigned char *
/usr/bin/gcc -I/opt/local/include -I. -I/opt/local/include -I../.. -I../../. -I../.././ext/openssl -DRUBY_EXTCONF_H="extconf.h" -I'/home/damian/.rbenv/versions/ree-1.8.7-2011.03/include' -I'/home/damian/.rbenv/versions/ree-1.8.7-2011.03/include' -fPIC -g -O2 -c ossl_x509crl.c
/usr/bin/gcc -I/opt/local/include -I. -I/opt/local/include -I../.. -I../../. -I../.././ext/openssl -DRUBY_EXTCONF_H="extconf.h" -I'/home/damian/.rbenv/versions/ree-1.8.7-2011.03/include' -I'/home/damian/.rbenv/versions/ree-1.8.7-2011.03/include' -fPIC -g -O2 -c ossl.c
/usr/bin/gcc -I/opt/local/include -I. -I/opt/local/include -I../.. -I../../. -I../.././ext/openssl -DRUBY_EXTCONF_H="extconf.h" -I'/home/damian/.rbenv/versions/ree-1.8.7-2011.03/include' -I'/home/damian/.rbenv/versions/ree-1.8.7-2011.03/include' -fPIC -g -O2 -c ossl_pkcs12.c
/usr/bin/gcc -I/opt/local/include -I. -I/opt/local/include -I../.. -I../../. -I../.././ext/openssl -DRUBY_EXTCONF_H="extconf.h" -I'/home/damian/.rbenv/versions/ree-1.8.7-2011.03/include' -I'/home/damian/.rbenv/versions/ree-1.8.7-2011.03/include' -fPIC -g -O2 -c ossl_ssl.c
ossl_ssl.c:101:5: warning: initialization from incompatible pointer type [enabled by default]
ossl_ssl.c:101:5: warning: (near initialization for ‘ossl_ssl_method_tab[0].func’) [enabled by default]
ossl_ssl.c:102:5: warning: initialization from incompatible pointer type [enabled by default]
ossl_ssl.c:102:5: warning: (near initialization for ‘ossl_ssl_method_tab[1].func’) [enabled by default]
ossl_ssl.c:103:5: warning: initialization from incompatible pointer type [enabled by default]
ossl_ssl.c:103:5: warning: (near initialization for ‘ossl_ssl_method_tab[2].func’) [enabled by default]
ossl_ssl.c:104:1: error: ‘SSLv2_method’ undeclared here (not in a function)
ossl_ssl.c:105:1: error: ‘SSLv2_server_method’ undeclared here (not in a function)
ossl_ssl.c:106:1: error: ‘SSLv2_client_method’ undeclared here (not in a function)
ossl_ssl.c:107:5: warning: initialization from incompatible pointer type [enabled by default]
ossl_ssl.c:107:5: warning: (near initialization for ‘ossl_ssl_method_tab[6].func’) [enabled by default]
ossl_ssl.c:108:5: warning: initialization from incompatible pointer type [enabled by default]
ossl_ssl.c:108:5: warning: (near initialization for ‘ossl_ssl_method_tab[7].func’) [enabled by default]
ossl_ssl.c:109:5: warning: initialization from incompatible pointer type [enabled by default]
ossl_ssl.c:109:5: warning: (near initialization for ‘ossl_ssl_method_tab[8].func’) [enabled by default]
ossl_ssl.c:110:5: warning: initialization from incompatible pointer type [enabled by default]
ossl_ssl.c:110:5: warning: (near initialization for ‘ossl_ssl_method_tab[9].func’) [enabled by default]
ossl_ssl.c:111:5: warning: initialization from incompatible pointer type [enabled by default]
ossl_ssl.c:111:5: warning: (near initialization for ‘ossl_ssl_method_tab[10].func’) [enabled by default]
ossl_ssl.c:112:5: warning: initialization from incompatible pointer type [enabled by default]
ossl_ssl.c:112:5: warning: (near initialization for ‘ossl_ssl_method_tab[11].func’) [enabled by default]
ossl_ssl.c: In function ‘ossl_ssl_get_cipher’:
ossl_ssl.c:1224:12: warning: assignment discards ‘const’ qualifier from pointer target type [enabled by default]
make[1]: ** [ossl_ssl.o] Error 1
make[1]: Leaving directory `/tmp/ruby-build.20111028140052.26318/ruby-enterprise-1.8.7-2011.03/source/ext/openssl'
make: *** [all] Error 1

ruby-build should have a version number

I'm currently in the process of cleaning up my rbenv, ruby-build and ruby-gemset Debian packages in order to release them as a PPA.

It would be great if ruby-build had a version number that I could use for this purpose. (Even if it's just 0.1.0.pre1 or something similar.)

JRuby recipes that upgrade rubygems breaks maven integration

JRuby ships with maven integration (allowing you to do gem mvn:rhino:js for example) in rubygems. Upgrading rubygems overwrites these custom rubygems libraries.

Is upgrading them explicitly (currently only done in 1.6.4 and 1.7.0-dev) required. This seems like something the user could do easily later if needed.

Build ruby with shared library

I'm not sure whether there is a good reason for this, but ruby-build does not build a ruby shared library.

This caused an issue for me when trying to build the zookeeper gem (ruby 1.9.2-p290), which fails to compile.

I solved the issue by recompiling ruby with

./configure --prefix=$HOME/.rbenv/versions/1.9.2-p290 --enable-shared

RVM appears to do this by default - can ruby-build do the same?

Thanks!

Is Ruby 1.9.3.rc1 production-ready?

Or, to put it another way, are you using 1.9.3 in production at 37signals?

I ask because I'm on 1.9.2-p290 and Rails 3.0.10, and while my app runs snappily its startup is glacial.

Thanks for this great software, and rbenv too!

ruby-build doesn't seem to find gcc even though it it installed

I'm using ruby-build 20111030 and Mac OS X (10.7.2)

$ ruby-build -v
ruby-build 20111030

When I try to build ruby 1.8.7-p249, ruby-build tells me it couldn't find a suitable gcc binary on my system

$ ruby-build 1.8.7-p249 ~/.rbenv/versions/1.8.7-p249

ERROR: This package must be compiled with GCC, and we
couldn't find a suitable `gcc' binary on your system.
Please install GCC and try again.

As of version 4.2, Xcode is LLVM-only and no longer
includes GCC. You can install GCC with these binary
packages on Mac OS X:

https://github.com/kennethreitz/osx-gcc-installer/downloads


BUILD FAILED

But it looks like gcc is correctly installed on my system :

$ which gcc
/usr/bin/gcc

$ gcc --version
i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Any idea?

1.9.3-rc1 installation failed on RHEL

I just pulled the latest repo changes, ran sudo ./install.sh, and then rbenv install 1.9.3-rc1. Although this worked for me on my OS X laptop, it failed on my RHEL server.

The last few lines of the log are:

installing default zlib libraries
linking shared-object zlib.so
make[2]: Leaving directory `/tmp/ruby-build.20111020064043.2396/ruby-1.9.3-rc1/ext/zlib'
make[2]: Entering directory `/tmp/ruby-build.20111020064043.2396/ruby-1.9.3-rc1'
linking ruby
make[2]: Leaving directory `/tmp/ruby-build.20111020064043.2396/ruby-1.9.3-rc1'
make[1]: Leaving directory `/tmp/ruby-build.20111020064043.2396/ruby-1.9.3-rc1'
Generating RDoc documentation
./ruby: symbol lookup error: /tmp/ruby-build.20111020064043.2396/ruby-1.9.3-rc1/.ext/i686-linux/enc/encdb.so: undefined symbol: rb_encdb_declare
make: *** [rdoc] Error 127

And my server's details:

$ uname -a
Linux my.host.name 2.6.18-53.1.6.el5xen #1 SMP Wed Jan 23 12:33:37 EST 2008 i686 athlon i386 GNU/Linux

How can I get this working please?

Tk

I'm trying to install the Tk bindings for Ruby. According to the instructions building Ruby would need to be:

% ./configure --prefix=<install-dir>
  --with-tcl-dir=/opt/ActiveTcl-8.5
  --with-tk-dir=/opt/ActiveTcl-8.5
  --with-tcllib=tclstub8.5 
  --with-tklib=tkstub8.5
  --enable-tcltk_stubs
  --enable-tcl-thread
  --enable-pthread
% make && make install

How can configure ruby-build to use these configure options?

use_gcc42_on_lion causes error on Snow Leopard

The use_gcc42_on_lion target raises a "BUILD FAILED" message on OSX 10.6.8 (Snow Leopard), but the Ruby / REE 1.8 build continues and succeeds just fine.

It's due to "set -E" and the second "if" statement in the use_gcc42_on_lion function, but I'm not really sure how to fix it short of just "set +E" in the function.

install rubinius from local sources

Hi,
What I wanted was an install recipe installing from my local copy instead of the remote, can anyone help me with this ?
I tried to write it but failed :(

Support Patches

I may find some time in a bit to try and submit a patch, but I thought it would be cool just to open a ticket and talk around this. It would be awesome if ruby-build allowed you to pass a patch argument. I have been using this for Ruby 1.9.3.preview1 since it allows you to GC tune like REE but for some reason echo's the hell out of your setting all over the place.

https://gist.github.com/1124322

Applying patches is not necessarily a big deal, but in my view, using 1.9.3 with GC turning without that patch drives me batty. If you can provide directions on how you might like to see a patch for patch :) I would be willing to try.

Keep ruby source around for further tinkering

I was sad to see my the source directory for my newly built ruby be wiped away as soon as rb-env completed. I wanted to go in and rebuild readline, since it failed to do so by default.

I really was a fan of how rvm kept the source for rubies around in ~/.rvm/src. Not sure if most people will find it helpful or not... maybe I am a minority case.

Support for additional ./configure flags

Hi there,

I like to use ruby/irb with readline support (vi key bindings). I had to modify the two "./configure" lines in your ruby-build script to get there.

Modified version: ./configure --with-readline-dir="/usr/local/Cellar/readline/6.2.1" ...

Did I miss an easy way to accomplish this or should this be supported by a flag?

Anyways, I like the rbenv/ruby-build combination.

1.9.3-p0 build failed on OS X Lion 10.7.2

$ rbenv install 1.9.3-p0
Downloading http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz...
Installing yaml-0.1.4...
Installed yaml-0.1.4 to /Users/cjbottaro/.rbenv/versions/1.9.3-p0
Downloading http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p0.tar.gz...
Installing ruby-1.9.3-p0...

BUILD FAILED

Inspect or clean up the working tree at /var/folders/98/83mjk36d4ts49lpbjvbz48f80000gn/T/ruby-build.20111030161956.28281
Results logged to /var/folders/98/83mjk36d4ts49lpbjvbz48f80000gn/T/ruby-build.20111030161956.28281.log

Last 10 log lines:
ossl_x509store.c: In function ‘ossl_x509stctx_set_flags’:
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)
linking shared-object openssl.bundle
make: *** [build-ext] Error 2

I did a brew installation of both rbenv and ruby-build about 15 mins ago, so I should be all up to date.

Default install location

Would it be possible to configure a default install location, e.g.

$ cat ~/.ruby-build
location="~/local/ruby-"

So that:

$ ruby-build 1.9.2-p290 

Would be the same as:

$ ruby-build 1.9.2-p290 ~/local/ruby-1.9.2-p290

ruby-build: definition not found: 1.9.2-p290

Trying to install 1.9.2-p290 in what appears to be a Red Hat machine. uname -a gives:

Linux web202.webfaction.com 2.6.18-238.9.1.el5PAE #1 SMP Tue Apr 12 18:52:55 EDT 2011 i686 i686 i386 GNU/Linux

when I do 'ruby-build --definitions', I get:

I'm on ruby-build 20111030.

1.8.6-p420 build failed on Ubuntu 10.4 Lucid Lynx

$ rbenv install 1.8.6-p420 
Downloading http://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.6-p420.tar.gz...
Installing ruby-1.8.6-p420...

BUILD FAILED

Inspect or clean up the working tree at /tmp/ruby-build.20111107212352.8310
Results logged to /tmp/ruby-build.20111107212352.8310.log

Last 10 log lines:
/usr/bin/gcc -g -O2  -DRUBY_EXPORT -D_GNU_SOURCE=1  -L. -L'/home/ingmar/.rbenv/versions/1.8.6-p420/lib'  -rdynamic -Wl,-export-dynamic   main.o  libruby-static.a -lrt -ldl -lcrypt -lm   -o miniruby
rbconfig.rb updated
compiling Win32API
compiling bigdecimal
make[1]: Entering directory `/tmp/ruby-build.20111107212352.8310/ruby-1.8.6-p420/ext/bigdecimal'
mkdir -p ../../.ext/i686-linux
make[1]: *** read jobs pipe: No such file or directory.  Stop.
make[1]: *** Waiting for unfinished jobs....
make[1]: Leaving directory `/tmp/ruby-build.20111107212352.8310/ruby-1.8.6-p420/ext/bigdecimal'
make: *** [all] Error 1

It's been suggested that this is a bug in the Ruby Makefiles, but all I know is that omitting '-j 2' from the make call solves the problem for me.

JRuby 1.7.0-dev snapshot url broken

Hi,

the download url of the 1.7.0-dev snapsho has changed:

$rbenv install jruby-1.7.0-dev
Downloading http://ci.jruby.org/snapshots/jruby-bin-1.7.0.dev.tar.gz...

BUILD FAILED

see my pull request.

libncursesw5-dev for ruby 1.9+

Without this lib utf8 chars are broken in curses (commandline apps),
it would be great if it would somehow get installed before installing ruby.
Its no hard dependency, just a nice thing to have.

PREFIX_PATH broken w/ jruby-1.6.4

Installed with:

➜  ~  ruby-build jruby-1.6.4 ~/.rbenv/versions/jruby-1.6.4 
Downloading http://jruby.org.s3.amazonaws.com/downloads/1.6.4/jruby-bin-1.6.4.tar.gz...
Installing jruby-1.6.4...
Installed jruby-1.6.4 to /Users/justin/.rbenv/versions
Downloading http://production.cf.rubygems.org/rubygems/rubygems-1.6.2.tgz...
Installing rubygems-1.6.2...
Installed rubygems-1.6.2 to /Users/justin/.rbenv/versions
➜  ~  

The dir is emtpy:

➜  ~  ls -al .rbenv/versions/jruby-1.6.4 
total 0
drwxr-xr-x  2 justin  justin   68 Sep  6 16:29 .
drwxr-xr-x  8 justin  justin  272 Sep  6 16:54 ..

Looks like it's installing it into the ~/.rbenv/versions dir itself :-(

➜  ~  ls -al .rbenv/versions/           
total 0
drwxr-xr-x   8 justin  justin  272 Sep  6 16:54 .
drwxr-xr-x  13 justin  justin  442 Sep  6 16:51 ..
drwxr-xr-x   5 justin  justin  170 Aug 15 14:20 1.8.4
drwxr-xr-x   5 justin  justin  170 Aug 16 08:44 1.8.7-p352
drwxr-xr-x   6 justin  justin  204 Aug 15 13:52 1.9.2-p290
drwxr-xr-x  11 justin  justin  374 Aug 15 13:51 jruby-1.6.3
drwxr-xr-x   2 justin  justin   68 Sep  6 16:29 jruby-1.6.4
drwxr-xr-x  11 justin  justin  374 Aug 19 11:12 rbx-1.2.4
➜  ~  

ruby-build 20110906

use check-install?

Is there any chance you could change ruby-build to use check-install & dpkg on debian/ubuntu? Then I could use it with my teleport gem:

https://github.com/rglabs/teleport

I'd love to get rid of my ruby install code and I'm sure your version is much better. But I also want users to be able to UN-install.

Thanks - Adam

Should support zero-documentation install

Ruby-Build should support installing ruby and rubygems with zero documentation files.

There are about 60MB of documentation files installed by default into /usr/local/share/ri/1.9.1/system/. Ruby-Build should support installing ruby/rubygems without these files.

A use case is installing Ruby automatically on many identically-configured servers. One needs a single copy of the documentation locally, but does not need dozens of copies of the documentation on remote servers. Rather, it would be useful to save on disk space (60MB here, 50MB there, eventually it adds up to a lot).

rbenv-install belongs to rbenv

I would think that rbenv-install really belongs with rbenv not ruby-build. I think it would be better to move it to that project, or alternately make it a separate program on it's own.

I realize one can just ignore rbenv-install, but I think the separation is better. Also, per my next issue (#103), I think it makes even more sense.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.