Skip to content

Commit 458d692

Browse files
committed
Rework the readme to emphasize plugin installation
1 parent 997c1d3 commit 458d692

File tree

1 file changed

+115
-32
lines changed

1 file changed

+115
-32
lines changed

README.md

Lines changed: 115 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,35 @@
11
# ruby-build
22

3-
ruby-build provides a simple way to compile and install different
4-
versions of Ruby on UNIX-like systems.
3+
ruby-build is an [rbenv](https://github.com/sstephenson/rbenv) plugin
4+
that provides an `rbenv install` command to compile and install
5+
different versions of Ruby on UNIX-like systems.
56

6-
### Installing ruby-build
7+
You can also use ruby-build without rbenv in environments where you
8+
need precise control over Ruby version installation.
9+
10+
11+
## Installation
12+
13+
### Installing as an rbenv plugin (recommended)
14+
15+
Installing ruby-build as an rbenv plugin will give you access to the
16+
`rbenv install` command.
17+
18+
$ mkdir -p ~/.rbenv/plugins
19+
$ cd ~/.rbenv/plugins
20+
$ git clone git://github.com/sstephenson/ruby-build.git
21+
22+
This will install the latest development version of ruby-build into
23+
the `~/.rbenv/plugins/ruby-build` directory. From that directory, you
24+
can check out a specific release tag. To update ruby-build, run `git
25+
pull` to download the latest changes.
26+
27+
### Installing as a standalone program (advanced)
28+
29+
Installing ruby-build as a standalone program will give you access to
30+
the `ruby-build` command for precise control over Ruby version
31+
installation. If you have rbenv installed, you will also be able to
32+
use the `rbenv install` command.
733

834
$ git clone git://github.com/sstephenson/ruby-build.git
935
$ cd ruby-build
@@ -14,54 +40,111 @@ write permission to `/usr/local`, you will need to run `sudo
1440
./install.sh` instead. You can install to a different prefix by
1541
setting the `PREFIX` environment variable.
1642

17-
If you only intend to use ruby-build via rbenv then you can
18-
install it locally as a plugin:
43+
To update ruby-build after it has been installed, run `git pull` in
44+
your cloned copy of the repository, then re-run the install script.
1945

20-
$ mkdir -p ~/.rbenv/plugins
21-
$ cd ~/.rbenv/plugins
22-
$ git clone git://github.com/sstephenson/ruby-build.git
46+
### Installing with Homebrew (for OS X users)
2347

24-
And if you're using Homebrew, you can just
48+
Mac OS X users can install ruby-build with the
49+
[Homebrew](http://mxcl.github.com/homebrew/) package manager. This
50+
will give you access to the `ruby-build` command. If you have rbenv
51+
installed, you will also be able to use the `rbenv install` command.
52+
53+
*This is the recommended method of installation if you installed rbenv
54+
with Homebrew.*
2555

2656
$ brew install ruby-build
2757

28-
to get the latest release, or
58+
Or, if you would like to install the latest development release:
2959

3060
$ brew install --HEAD ruby-build
3161

32-
to pull the latest from git.
3362

63+
## Usage
64+
65+
### Using `rbenv install` with rbenv
66+
67+
To install a Ruby version for use with rbenv, run `rbenv install` with
68+
the exact name of the version you want to install. For example,
69+
70+
$ rbenv install 1.9.3-p194
71+
72+
Ruby versions will be installed into a directory of the same name
73+
under `~/.rbenv/versions`.
74+
75+
To see a list of all available Ruby versions, run `rbenv install`
76+
without any arguments. You may also tab-complete available Ruby
77+
versions if your rbenv installation is properly configured.
78+
79+
### Using `ruby-build` standalone
80+
81+
If you have installed ruby-build as a standalone program, you can use
82+
the `ruby-build` command to compile and install Ruby versions into
83+
specific locations.
84+
85+
Run the `ruby-build` command with the exact name of the version you
86+
want to install and the full path where you want to install it. For
87+
example,
88+
89+
$ ruby-build 1.9.3-p194 ~/local/ruby-1.9.3-p194
90+
91+
To see a list of all available Ruby versions, run `ruby-build
92+
--definitions`.
93+
94+
Pass the `-v` or `--verbose` flag to `ruby-build` as the first
95+
argument to see what's happening under the hood.
96+
97+
### Custom definitions
98+
99+
Both `rbenv install` and `ruby-build` accept a path to a custom
100+
definition file in place of a version name. Custom definitions let you
101+
develop and install versions of Ruby that are not yet supported by
102+
ruby-build.
103+
104+
See the [ruby-build built-in
105+
definitions](https://github.com/sstephenson/ruby-build/tree/share/ruby-build)
106+
as a starting point for custom definition files.
107+
108+
### Special environment variables
109+
110+
You can set certain environment variables to control the build
111+
process.
34112

35-
### Installing Ruby
113+
* `TMPDIR` sets the location where ruby-build stores temporary files.
114+
* `RUBY_BUILD_BUILD_PATH` sets the location in which sources are
115+
downloaded and built. By default, this is a subdirectory of
116+
`TMPDIR`.
117+
* `CC` sets the path to the C compiler.
118+
* `CONFIGURE_OPTS` lets you pass additional options to `./configure`.
119+
* `MAKE_OPTS` (or `MAKEOPTS`) lets you pass additional options to
120+
`make`.
36121

37-
To install a Ruby version, run the `ruby-build` command with the path
38-
to a definition file and the path where you want to install it. (A
39-
number of [built-in
40-
definitions](https://github.com/sstephenson/ruby-build/tree/master/share/ruby-build)
41-
may be specified instead.)
122+
### Keeping the build directory after installation
42123

43-
$ ruby-build 1.9.2-p290 ~/local/ruby-1.9.2-p290
44-
...
45-
$ ~/local/ruby-1.9.2-p290/bin/ruby --version
46-
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin11.0.0]
124+
Both `ruby-build` and `rbenv install` accept the `-k` or `--keep`
125+
flag, which tells ruby-build to keep the downloaded source after
126+
installation. This can be useful if you need to use `gdb` and
127+
`memprof` with Ruby.
47128

48-
You can use it with [rbenv](https://github.com/sstephenson/rbenv):
129+
Source code will be kept in a parallel directory tree
130+
`~/.rbenv/sources` when using `--keep` with the `rbenv install`
131+
command. You should specify the location of the source code with the
132+
`RUBY_BUILD_BUILD_PATH` environment variable when using `--keep` with
133+
`ruby-build`.
49134

50-
$ ruby-build 1.9.2-p290 ~/.rbenv/versions/1.9.2-p290
51135

52-
ruby-build provides an `rbenv-install` command that shortens this to:
136+
## Getting Help
53137

54-
$ rbenv install 1.9.2-p290
138+
Please see the [ruby-build
139+
wiki](https://github.com/sstephenson/ruby-build/wiki) for solutions to
140+
common problems.
55141

56-
ruby-build supports $RUBY_BUILD_BUILD_PATH to override the location in which
57-
sources are downloaded and built. The -k/--keep flags will preserve this path
58-
after the build is complete.
142+
If you can't find an answer on the wiki, open an issue on the [issue
143+
tracker](https://github.com/sstephenson/ruby-build/issues). Be sure to
144+
include the full build log for build failures.
59145

60-
rbenv-install also supports the -k/--keep flag, and additionally supports an
61-
environment variable option $RBENV_BUILD_ROOT that when set, will always build
62-
sources under that location, and keep the sources after build completion.
63146

64-
### Version History
147+
## Version History
65148

66149
#### 20120423
67150

0 commit comments

Comments
 (0)